Do you know Javascript … Try these puzzle
Do you know Javascript … Try these puzzle
Javascript is one the most miss-understood language among developers. Everyday I learn new lesson about it.While going through few articles I thought of following JS language puzzles.
Handling Arrayvar days = ['Monday', 'Tuesday','Wednesday','Thursday','Friday', 'Saturday'];
var length = days.length;
console.log('No of days are ' + days.length);
//Opps we missed Sunday, lets add it
days[++length] = 'Sunday';
console.log('Final no of days are ' + days.length);
It is obvious that no of days are 7…. is it ?
Written with StackEdit.
8 because you are adding the element at the 7th index?
ReplyDelete~alosh