NEW
Font size
WorksheetsJavaScript Quiz
Total questions: 12
Worksheet time: 6mins
function aaa() {
return
{
test: 1
};
}
alert(typeof aaa());
What does the above alert?
User defined
Object
Number
function
Inside which HTML element do we put the JavaScript?
<script>
<javaScript>
<js>
<scripting>
Where is the correct place to insert a JavaScript?
The <head> section
The <body> section
both the <head> and <body> section are correct
Which is the correct way to write a JavaScript array?
var txt = new Array(1:"arr",2:"kim",3:"jim")
var txt = new Array:1=(" arr ")2=("kim")3=("jim")
var txt = new Array("arr ","kim","jim")
var txt = new Array=" arr ","kim","jim"
Which of the following is correct to write “Hello World” on the web page?
System.out.println(“Hello World”)
print(“Hello World”)
document.write(“Hello World”)
response.write(“Hello World”)
Which of the following is not a valid JavaScript variable name?
2java
_java_and_ java _names
javaandjava
None of the above
Why so Java and JavaScript have similar name?
Java Script is a stripped-down version of Java
The syntax of JavaScript is loosely based on Java syntax
They both support Object Oriented Programming
None of the above
How do you create a function in JavaScript?
function myFunction()
function:myFunction()
function=myFunction()
How do you call a function named "myFunction"?
call function myFunction()
call myFunction()
myFunction()
How can you add a comment in a JavaScript?
//This is comment
'This is comment
<!-- This is comment-->
How do you declare a JavaScript variable?
v carName
variable carName
var carName
Is JavaScript case-sensitive?
yes
No
