adplus-dvertising
frame-decoration

Question

Consider the following code snippet:

const pi=3.14;
var pi=4;
console.log(pi);

What will be the output for the above code snippet?

a.

This will flash an error

b.

Prints 4

c.

Prints 3.14

d.

Ambiguity

Answer: (a).This will flash an error

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. Consider the following code snippet: const pi=3.14; var pi=4; console.log(pi); What will be the output for the above code snippet?

Similar Questions

Discover Related MCQs

Q. The let keyword can be used

Q. The main difference between the variables declared with var and with let is

Q. Consider the following code snippet:

console.log(p)

If p is not defined, what would be the result or type of error?

Q. Consider the following code snippet:

let x=x+1;
console.log(x);

What will be the result for the above code snippet?

Q. Consider the following code snippet:

[x,y]=[y,x];

What is the result of the above code snippet?

Q. Which looping statement allows XML tags to appear in JavaScript programs and adds API for operating on XML data?

Q. Which exception does the Iterators throw from their next() method when there are no more values to iterate, that work on finite collections ?

Q. Which method of the iterable object returns an iterator object for the collection?

Q. Consider the following code snippet:

let succ = function(x) x+1, yes = function() true, no = function() false;

What convenience does the above code snippet provide?

Q. Consider the following code snippet:

data.sort(function(a,b),b-a);

What does the above code do?

Q. What is the code to be used to trim whitespaces ?

Q. What will be the reaction when a catch clause has no conditionals ?

Q. When will the finally block be called?

Q. What is the return type of typeof for standard JavaScript objects?

Q. Which method to use while working with XML fragments, instead of XML()?

Q. Which of the following is the descendant operator?

Q. Which of the following is an example to perform the most common XML manipulations using the XML objects invocation?

Q. What is the code required to delete all "weight" tags?