JavaScript

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

How do you create a function in JavaScript?

function name(parameter1, parameter2, parameter3) { code to be executed on quiz answer: function myFunction()

What is the correct way to write a JavaScript array?

var colors = ["red", "green", "blue"]

How do you declare a JavaScript variable?

var x = 5; var y = 6; var z = x + y;

How to insert a comment that has more than one line?

/*This comment has more than one line*/

What is the correct syntax for referring to an external script called "xxx.js"?

<script src="xxx.js">

How to write an IF statement in JavaScript?

if (condition) { block of code to be executed if the condition is true } On quiz answer: if (i == 5)

How to write an IF statement for executing some code if "i" is NOT equal to 5?

if (i != 5)

How do you call a function named "myFunction"?

myFunction() For reference: function name(parameter1, parameter2, parameter3) { code to be executed

Which event occurs when the user clicks on an HTML element?

onclick

Where is the correct place to insert a JavaScript?

the <head> or the <body> section

How can you add a comment in a JavaScript?

//This is a comment

what is a JavaScript Array?

Arrays are used to store multiple values in a single variable. ex) var cars = ["something", "somethingelse", "hi";] Basically, it is a special variable that can hold more than one value at a time.

The external JavaScript file must contain the <script> tag.

False

Is JavaScript case sensitive?

Yes

How do you write "Hello World" in an alert box?

alert("Hello World");


Set pelajaran terkait

US History: 1.6 - Effects of the Civil War and Reconstruction

View Set

ACSR4 - Defining Agency E&O Basics

View Set

Mental Health Exam 2 NCLEX questions

View Set

Risk Management and Insurance Topic Test (100%)

View Set