javascript section - 3
javascript section - 3
28. What is the difference in the outputs that you get when you use the
following operators =; == ; and ===.
Answer –
a. The assignment operator equal to (=) changes the value of the expression
on its right to that of the variable to the left of the equal sign.
b. A comparison operator called double equals (==) changes operands of the
same type before comparison.
c. In JavaScript, the stringent equality comparison operator === (Triple
equals) returns false for values that are not of the same type. With this
operator, type casting is done for equality. It will give a false result if we
compare 2 with “2” using the comparison operator ===.
36. What happens when a user clicks the cancel button of the prompt
dialog box?
Answer – If the user clicks the Cancel button, prompt( ) returns null.
<html>
<script>
var phoneno;
</script>
</html>
39. Write a program to ask the user to input two values and then perform
the arithmetic operation and display the result.
<html>
<script>
var num1,num2,sum;
num1=parseInt(prompt("Enter Number"));
num2=parseInt(prompt("Enter Number"));
sum=num1+num2;
</script>
</html>
Q.6: What will be the output of the following codes 2 - 3 3 - 2 false - 5 true + 3 5 + "foo"
Q.8: What is the difference in the outputs that you get when you use the following operators =; == ;
and ===.
Q.11: explain what a logical not operator does using some examples.
(c) , ............................ and ............................ are all logical operators used in JavaScript
(g) When i want to display an alert which says ‘Welcome’ and then the name of the student, i will
have the use the ............................ operator.