wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Javascript Basics

Total questions: 10

Worksheet time: 6mins

Name
Class
Date
1.

Which of the following is NOT a valid data type in JavaScript?

a)

let

b)

var

c)

float

d)

const

2.

What is the correct way to write a comment in JavaScript?

a)

<!-- This is a comment -->

b)

// This is a comment

c)

/* This is a comment */

d)

This is a comment

3.

You are creating a web application for a dog walking business. In the code, you want to check if a dog is considered a puppy (less than 1 year old) to determine the walk price. Which if statement would work for this?

a)

if (dogAge > 1) { // set puppy price }

b)

if (dogAge < 1) { // set puppy price }

c)

if (dogAge <= 365) { // set puppy price }

d)

if (dogAge < 1) { // set puppy price }}

4.

What does the NaN value represent in JavaScript?

a)

Not a Number

b)

Null

c)

No Arguments

d)

Negative Nymber

5.

How can you access the length of an array in JavaScript?

a)

array.length()

b)

length(array)

c)

array.length

d)

lengthOf(array)

6.

What does the return statement do in a JavaScript function?

a)

It terminates the function execution.

b)

It returns a value from the function.

c)

It defines a new function.

d)

It creates a loop.

7.

How do you define a function in JavaScript

a)

function = climbUp();

b)

fun = "climbUp";

c)

function climbUp();

d)

fun = (climbUp());

8.
Indicates the beginning  and the end of a JavaScript section.
a)
<html> </html>
b)
<style> </style>
c)
<article> </article>
d)
<script> </script>
9.

  1. Which function is used to print content to the console in JavaScript?

a)

console.log();

b)

print()

c)

log()

d)

display()

10.

Which of the following platform(s) can be used to run Javascript Code

a)

Google Chrome

b)

Firefox

c)

Microsoft Edge

d)

Safari