Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Array question 2 #91

Open
Rishabh1208 opened this issue Apr 11, 2020 · 2 comments
Open

Array question 2 #91

Rishabh1208 opened this issue Apr 11, 2020 · 2 comments

Comments

@Rishabh1208
Copy link

In the Array topic, the answer to question2 is wrong.
It should be 2 i.e ([] [undefined × 100] Array[5] 1)

@ryancwalsh
Copy link

I agree that https://github.com/ganqqwerty/123-Essential-JavaScript-Interview-Questions#2-what-would-be-the-output-of-following-code-2 is incorrect.

(function() {
	var array1 = [];
	var array2 = new Array(100);
	var array3 = new Array(['1',2,'3',4,5.6]);
	console.log(array1);
	console.log(array2);
	console.log(array3);
	console.log(array3.length);
}());

But to clarify what @Rishabh1208 is saying...

For me, in Windows Chrome, the result is:

[]
[empty × 100]
[["1", 2, "3", 4, 5.6]]
1

Thanks for a really helpful long list of thought-provoking questions, though. :-)

@Rishabh1208
Copy link
Author

Thanks @ryancwalsh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants