0 votes
in JavaScript by
In JavaScript, what is the use of the prompt box?

1 Answer

0 votes
by
The prompt box in JavaScript helps the user to input with the help of a text box. The prompt() method helps to display the dialog box which prompts the visitor to provide an input.

Q42. What outcome will come out of this code:

var Y = 1;

if (function F(){})

{

y += Typeof F;</span>

}

console.log(y);

1undefined will be the output. This is because the if condition statement will evaluate using ‘eval’ and hence, eval(function f(){}) will return function f(){} (true). So, inside this if statement, one would execute the typeof f which will return undefined since the if statement code is executed at run time. Thus, the statement present inside the if condition is going to be evaluated during the run time.
...