Skip to content

Instantly share code, notes, and snippets.

@fabriciofmsilva
Last active August 28, 2019 14:32
Show Gist options
  • Save fabriciofmsilva/7c9371e226fc1357d29486406d9f70b7 to your computer and use it in GitHub Desktop.
Save fabriciofmsilva/7c9371e226fc1357d29486406d9f70b7 to your computer and use it in GitHub Desktop.
Interview questions
const a = 1;
let b = 2;
var c = 3;

console.log(window.a, window.b, window.c);

A) 1, 2, 3 B) undefined, 2, 3 C) undefined, undefined, 3 D) undefined, undefined, undefined


let myArray = ['one', 'two', 'three', 'four', 'five'];
myArray.fill('Peach');

console.log(myArray);
// ["Peach", "Peach", "Peach", "Peach", "Peach"]

myArray.fill(7, 2);

console.log(myArray);
// ["Peach", "Peach", 7, 7, 7]

myArray.fill('Onion', 2, 4);

console.log(myArray);
// ["Peach", "Peach", "Onion", "Onion", 7]

myArray.fill('Apple', -4, -2);

console.log(myArray);
// ["Peach", "Apple", "Apple", "Onion", 7]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment