JavaScript (JS) Cheat Sheet

JavaScript (JS) Cheat Sheet

Assessment

Flashcard

Computers

10th Grade

Easy

Created by

Joseph Armanious

Used 8+ times

FREE Resource

Student preview

quiz-placeholder

122 questions

Show all answers

1.

FLASHCARD QUESTION

Front

How to include an external JavaScript file?

Back

<script src="filename.js"></script>

2.

FLASHCARD QUESTION

Front

What is the syntax for a function in JavaScript?

Back

function addNumbers(a, b) { return a + b; }

3.

FLASHCARD QUESTION

Front

How do you edit a DOM element in JavaScript?

Back

document.getElementById("elementID").innerHTML = "Hello World!";

4.

FLASHCARD QUESTION

Front

How to output data to the browser console in JavaScript?

Back

console.log(a);

5.

FLASHCARD QUESTION

Front

What is the syntax for a for loop in JavaScript?

Back

for (var i = 0; i < 10; i++) { document.write(i + ": " + i*3 + "
"); }

6.

FLASHCARD QUESTION

Front

How do you declare a variable in JavaScript?

Back

var a; // variable a = 1; // assignment

7.

FLASHCARD QUESTION

Front

What is the purpose of 'use strict' in JavaScript?

Back

"use strict"; // Use strict mode to write secure code

Create a free account and access millions of resources

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

By signing up, you agree to our Terms of Service & Privacy Policy

Already have an account?