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

Coding Questions -> Arrays -> 2. What would be the output of following code? #63

Closed
nomean42 opened this issue Oct 29, 2018 · 2 comments

Comments

@nomean42
Copy link

(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);
}());
  1. [] [] [Array[5]] 1
  2. [] [undefined × 100] Array[5] 5
  3. [] [] ['1',2,'3',4,5.6] 5
  4. [] [] [Array[5]] 5

Answer: 1) [] [] [Array[5]] 1

Correct is [] [undefined × 100] [Array[5]] 1

@ganqqwerty
Copy link
Owner

Oops , it seems that you’re right! I will check it again when I have access to the computer

ganqqwerty added a commit that referenced this issue Nov 11, 2018
@ganqqwerty
Copy link
Owner

thanks so much!

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