click below
click below
Normal Size Small Size show me how
JAVASCRIPT WEEK 6
Question | Answer |
---|---|
<script> var studentGrade =18; testFunction(); function testFunction() { studentGrade =19; } </script> What kind of variable is the variable 'studentGrade'; Global or Local variable? | Global Variable. |
<script> var number=22; testFunction(); function testFunction() { number =25; } </script> What is the final value of number? | 25 |
<script> var number=22; testFunction(); function testFunction() { var number =25;} </script> document.write(number); What will print last line of code? | 22 |
<script> var str = "Javascript course "; var str2="course"; var position = str.search(str2); document.write("The value " + str2 + " starts from:" + position); </script> What is the result of the code above? | 11 |
<script> var num = 5.23; document.write(num); </script> What is the result of the code above? | 5.23 |
<script> var num1="20"; var num2="350"; document.write(num1+num2); </script> What is the result of the code above? | 20350 |
<script> var num1=10; var num2="45"; document.write(num1*num2); </script> What is the result of the code above? | 450 |
<script> var num = 6.256; document.write(num.toFixed(1)); </script> What is the result of the code above? | 6.3 |
<script> document.write(num.Number(true)); </script> What is the result of the code above? | 1 |
<script> document.write(num.parseInt(2.56)); </script> What is the result of the code above? | 2 |
<script> document.write(num.parseFloat(3.89)); </script> What is the result of the code above? | 3.89 |
What sin math method does? | It returns values between -1 and 1 which defines sine of the angle is given in radians. |