JavaScript Flashcards

1
Q

Which errors are typically syntax errors and usually cause error alerts?

A

Load-time errors

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Which method converts a string value to uppercase letters?

A

toUpperCase()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Which methods determines whether a value is a number?

A

isNaN()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What process combines two text strings using the plus sign?

A

concatenation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Which method converts a string to its integer equivalent?

A

parseInt()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What processes a function’s statements?

A

calling statement

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Which type of operator is this?

25 + 75

A

Arithmetic

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Which expression creates an integer value?

A

var birthYear = 1956

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How does a for loop start?

A

for (i = 0; i <= 5; i++)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Which event occurs when the user moves the mouse pointer over a link, image, or other visible element on a page?

A

mouseOver

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is a way of changing a variable from one data type to another?

A

casting

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Why is a reference technique used to access the property or method of an object?

A

dot notation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Which type of operator is this?

myNumber = 25

A

Assignment

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Which operator is used to assign values?

A

=

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Which expression creates a string value?

A

var name = “Andrew”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is the actual data values you provide in JS?

A

literal

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Which event occurs when a user clicks the mouse button outside of a particular input field?

A

blur

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What does a one line JS comment look like?

A

// this

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

Which data type holds any numeric value used for mathematical operations?

A

number

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

Which event occurs when the user highlights the text in a form field?

A

select

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

What type of variable is declared within a function and available only from within that function?

A

local variable

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

Which method converts a string to its floating point decimal equivalent?

A

parseFloat()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

What is a symbol or character used in expressions to store or evaluate a value?

A

operator

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

What is a part of a statement that is evaluated as a value?

A

expression

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

How do you declare a function?

A

function myFunction() {}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

What is a self-contained programming component that contains properties and methods?

A

object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

What are key characteristics and features of JavaScript?

A

an object-based language
based on event-driven model

platform independent

enables quick development

relatively easy to learn

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q

How do you apply inline scripting to an element?

A

<a>
click here
</a>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q

Which event occurs when the user modifies the value of a form field?

A

change

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
30
Q

Which event occurs when the user clicks on a link or form element?

A

click

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
31
Q

Which type of operator is this?

25 < 75

A

Logical

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
32
Q

What happens if you define a function but do not call it?

A

nothing

33
Q

Which method creates a pop up box with the specified message string and requests user input into the text field in the box?

A

prompt()

34
Q

What is a named set of statements that performs a task or calculates a value?

A

function

35
Q

How do you call this function?

function myFunction() {
   return “success”;
}
A

myFunction()

36
Q

Which event occurs when a page is closed?

A

unload

37
Q

Which errors are mathematical, casting errors, errors in proper command usage, or errors in the structure of the script, which result in the script running improperly?

A

Logic errors

38
Q

Which technique adds JS to a singe web page within either the or the ?

A

embedded scripting

39
Q

Which object allows you to determine information about the user’s browser?

A

navigator

40
Q

Which method creates a pop-up box with the specified message string, which the user can dismiss by clicking a button in the box?

A

alert()

41
Q

Which property returns a string value indicating the name of the client browser?

A

navigator.appName

42
Q

Which technique adds JavaScript to a single HTML element?

A

Inline scripting

43
Q

How do you find a number with the highest value of x and y?

A

Math.max(x,y)

44
Q

What must variable names begin with?

A

a letter
the underscore _
the dollar sign $

45
Q

Which technique adds JS by linking web pages to a text file with the .js file name extension?

A

external scripting

46
Q

What is a value or expression containing data or code that is passed on to a function?

A

argument

47
Q

How do you round the number 7.25 to the nearest integer?

A

Math.round(7.25)

48
Q

Which event occurs when there is a problem loading an external image or resource?

A

error

49
Q

What does a JS comment with more than one line look like?

A
/* like
this */
50
Q

What is a named space of memory?

A

variable

51
Q

Which event occurs when a form’s Submit button is clicked?

A

submit

52
Q

Which data type holds True or False values only?

A

Boolean

53
Q

What are actions that an object can be made to perform?

A

methods

54
Q

What type of variable is available throughout the entire script?

A

global variable

55
Q

Which value indicates that a variable has no value assigned yet?

A

undefined

56
Q

What are attributes of an object (e.g., height, color, font size, sentence length, etc.)?

A

Properties

57
Q

What describes when values are passed to a function, and the function’s parameters receive a copy of its arguments values?

function myFunction(x) {
   return x;
}
var num = 2;
myFunction(num);
A

pass by reference

58
Q

What is the correct way to change the content of the HTML element below?

<p>this is a demo</p>

A

document.getElementById(“demo”).innerHTML = “Hello World!”;

59
Q

What is used to output values from a function?

A

return

60
Q

Which errors occur after the script has loaded and is running, typically caused by improper use of commands?

A

Run-time errors

61
Q

Which type of operator is this?

z == 10

A

Comparison

62
Q

Which value indicates that the user enters nothing in a text box then submits the form?

A

null

63
Q

Which method creates a pop up box with the specified message string and requests user confirmation by clicking OK or Cancel button in the box?

A

confirm()

64
Q

How do you write an if statement if i is not equal to 5?

A

if (i != 5)

65
Q

What is the correct syntax to open a new window?

A

w2 = window.open(“URL”);

66
Q

Which property returns a string value indicating the version number of the client browser and the platform?

A

navigator.appVersion

67
Q

Which event occurs when a page is opened?

A

load

68
Q

Which method writes the specified string in the page?

A

document.write()

69
Q

Which data type holds any string of alphanumeric characters used for words or for numbered phrases that are not mathematically manipulated?

A

string

70
Q

How to write an if statement in JS?

A

if (i == 5)

71
Q

Which event occurs when the mouse pointer leaves a link, image, or other visible element on a page?

A

mouseOut

72
Q

Which event occurs when a firm’s Reset button is clicked?

A

reset

73
Q

Which event occurs when the loading of an image is terminated?

A

abort

74
Q

Which event occurs when a user clicks into a form field?

A

focus

75
Q

Does JS perform its functionality primarily on the client or server-side?

A

client side

76
Q

What describes when values are passed to a function, and the function’s parameters receive its argument’s actual values?

function myFunction(x) {
   return x;
}

myFunction(2);

A

pass by value

77
Q

Which type of operator makes decisions in a script?

(a > b) ? a++ : a- -

A

Conditional

78
Q

How does a while loop start?

A

while (i <= 10)