JavaScript Basics

JavaScript Basics

9th - 12th Grade

5 Qs

quiz-placeholder

Similar activities

Js the first

Js the first

12th Grade

10 Qs

TLEQ3M1-5

TLEQ3M1-5

10th Grade

10 Qs

Chapter 4. Introduction to Hypertext Pre-Processor - 4

Chapter 4. Introduction to Hypertext Pre-Processor - 4

12th Grade

10 Qs

Administración memoria y DOM con JavaScript

Administración memoria y DOM con JavaScript

10th Grade

10 Qs

Java Script

Java Script

9th Grade

10 Qs

JS Practice: ITS Certification

JS Practice: ITS Certification

12th Grade

10 Qs

web tasarım programlama-1

web tasarım programlama-1

12th Grade

10 Qs

Website Design

Website Design

KG - University

10 Qs

JavaScript Basics

JavaScript Basics

Assessment

Quiz

Computers

9th - 12th Grade

Hard

Created by

Richard Ghiorse

Used 4+ times

FREE Resource

5 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following will change the entire body of the HTML on a webpage to the text "Hacked by JavaScript"

document.innerHTML = "Hacked by JavaScript";

document.body = "Hacked by JavaScript";

document.body.innerHTML = "Hacked by JavaScript";

body = "Hacked by JavaScript";

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following JavaScript commands will change the HTML associated with any id "title" to the text "ECS is Fun".

document.title.innerHTML = "ECS is Fun";

document.getElementById("title").innerHTML = "ECS is Fun";

document.getElementById(title).innerHTML = ECS is Fun;

document.getElementById("title") = "ECS is Fun";

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following correctly uses a JavaScript variable that is initialized to 42?

var num = 42;

num = 42;

var 42;

var 42 = num;

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following stores all the HTML elements with the tag h2 into a variable called headings?

var headings = document.getElementsByTagName("h2");

var headings = getElementsByTagName("h2");

var headings = document.getElementsByTagName(h2);

headings = document.getElementsByTag(h2);

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Suppose we have the following JavaScript variable to retrieve all the paragraphs on a webpage:

var paragraphs = document.getElementsByTagName("p");

Which of the following changes the text of the second paragraph to "The second paragraph has been hacked!"

paragraphs[2] = "The second paragraph has been hacked!";

paragraphs[1] = "The second paragraph has been hacked!";

paragraphs[2].innerHTML = "The second paragraph has been hacked!";

paragraphs[1].innerHTML = "The second paragraph has been hacked!";