+ 1
Why not working?
function worker(name, age, paycheck, position) { this.name = name; this.age = age; this.paycheck = paycheck; this.position = position; } var p1 = new worker("Alex Ivanov", 25, 1000000, "trader"); var p2 = new worker("Serge Sidorov", 32, 500000, "consultant"); document.write(p1.name+" "); /*Alex Ivanov*/ document.write(p2.name.paycheck); /*undefined*/
4 Respuestas
+ 4
the second should be::
document.write(p2.paycheck)
not::
document.write(p2.name.paycheck)
+ 2
Max Rubs,
to make the second string "Serge Sidorov 500000" do:
document.write(p2.name + " " + p2.paycheck);
+ 1
thanks, but is it possible to make second string "Serge Sidorov 500000" ?
+ 1
Thanks Bro!