Skip to content

Instantly share code, notes, and snippets.

@AndrewSavetchuk
Last active March 17, 2024 23:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AndrewSavetchuk/5e30bc8ada08a91a80220ecfd4c93e9c to your computer and use it in GitHub Desktop.
Save AndrewSavetchuk/5e30bc8ada08a91a80220ecfd4c93e9c to your computer and use it in GitHub Desktop.

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