Question: Given the following javascript code: function func ( ) { if ( condition 1 ) { KEYWORD x = 4 2 / / KEYWORD intended

Given the following javascript code:
function func(){
if(condition1){
KEYWORD x =42//KEYWORD intended to be var, let, or const
}
if(condition2){
console.log(x)//Line1
}
}
Which ONE of the following is TRUE with regards to whether KEYWORD is var, let, or const?
Question 4 options:
//Line 1 will NOT be a "ReferenceError: x is not defined" error if KEYWORD is const.
//Line 1 will be a "ReferenceError: x is not defined" error if KEYWORD is let.
//Line 1 will be a "ReferenceError: x is not defined" error if KEYWORD is var.
//Line 1 will be a "ReferenceError: x is not defined" error regardless of whether KEYWORD is var, let, or const.
//Line 1 refers to global variable x regardless of whether KEYWORD is var, let, or const.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!