Skip to content

Instantly share code, notes, and snippets.

@AndrewSavetchuk
Last active February 25, 2023 06:37
Embed
What would you like to do?

JavaScript Logo

JavaScript Riddles

Try to guess what will be displayed in the console.

let arr = ['dog', 'cat', 'hen'];

arr[100] = 'fox';

console.log(arr.length);
Reveal Answer

Answer: 101

var a = 1;

function f1() {
    console.log(a);
}

function f2() {
    var a = 2;
  
    f1();
}

f2();
Reveal answer

Answer: 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment