What will be output in console:

var animals = ['Tiger', 'Lion', 'Camel', 'Cow', 'Duck'];
console.log(animals.slice(2, 4));
  • Array ["Camel", "Cow"]
Which of these lines of code would replace the content of a webpage with “Saaaaaakib”?
  • document.body.innerHTML = "Saaaaaakib";

When used as a constructor, like new MyFunction(), the value of this will be a brand new object provided by the JavaScript runtime. If we don’t explicitly return anything from that function, this will be considered its return value.

  • true

What does the below line do considering it as the first line in your javascript file:

(function(){
    alert(this);
})();
  • I will see an alert with not null value