Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,194,629 members, 7,955,305 topics. Date: Saturday, 21 September 2024 at 10:02 PM |
Nairaland Forum / Science/Technology / Webmasters / Test Your Javascript Knowledge (pt 3) (1366 Views)
Test Your Web Programming Skills / Test Your Javascript Knowledge (pt 2) / Test Your Javascript Knolwedge. (2) (3) (4)
Test Your Javascript Knowledge (pt 3) by my2cents(m): 4:08pm On Mar 27, 2008 |
What will be the results of the following alerts, given the code snippet below? function newClass() { this.firstName = "Kheme"; lastName = "in Cyprus"; } var nc = new newClass(); alert(nc.firstName); alert(nc.lastName); |
Re: Test Your Javascript Knowledge (pt 3) by Nobody: 3:32pm On Mar 29, 2008 |
2 pop up first 1 says kpeme second says undefined because the lastname variable you defined in the class has no "this" so you can't access the variable except from within the class definition function newClass() { |
Re: Test Your Javascript Knowledge (pt 3) by my2cents(m): 4:05pm On Mar 29, 2008 |
Brilliant! |
Re: Test Your Javascript Knowledge (pt 3) by kheme(m): 7:40pm On Apr 09, 2008 |
need i say anything? |
(1) (Reply)
Can I Use Graphcard To Pay For Google Adword? / Hotspot Shield To Logging Paypal: ! / Help Me With This Smtp Error
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 8 |