Anyone else can think of ideas | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Anyone else can think of ideas

Can you think of any ideas in JavaScript that are related to this code var courses=new.course("HTML5","CSS","JS") alert(courses)

2nd Aug 2017, 6:52 PM
The Shift
The Shift - avatar
1 Answer
+ 3
Related to your code, I can think to only one 'idea': << PEBCAK >> ( https://fr.m.wiktionary.org/wiki/PEBCAK ) :P 'new' is a reserved keyword in JS, so used as this it would produce an << unexpected identifier >> error... The most probable good way of writing it, if you've previously defined a 'course' function-class, would be: var courses = new course("HTML5","CSS","JS"); alert(courses); ... where it will display [object Object], while you doesn't override the .toString() method ^^
3rd Aug 2017, 6:52 AM
visph
visph - avatar