Essential JavaScript Flashcards

1
Q

Who developed JavaScript?

A

Netscape - Brendan Eich

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

What are some characteristics of JavaScrippt?

A
High-level scripting language
Case-sensitive
Intepreted at runtime (JIT compiler)
Object base
Loosely typed
Platform independent
Dynamic language (change on the fly)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is an object?

A

Self-contained set of related values and functions

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

What are properties?

A

Characteristics of an object (e.g. car.color in the object Car

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

What is a method?

A

A function that is a property of an object

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

Some JavaScript flavors?

A

ECMAScript
TypeScript
Mocha
JScript (Microsoft)

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

Microsoft intepretation of JavaScript

A

JScript

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

What is Node.JS?

A

Server-side JS

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

JavaScript interpreters (browser)

A

Google V8

Spidermonkey (FireFox)

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

No Script?

A

Your browser doesn’t support JavaScript

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

Type attribute?

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

What are the primitive data types?

A
String
Number
Boolean
Undefined
Null
Symbol
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Declare a variable

A

let myNumber = 10;

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

Expression

A

myNumber = 10;

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

Global Scope

A

Variables declared outside of a code block (use as little as possible)

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

Local Scope

A

Any variable using let or const inside a block

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

Some Keywords?

A
const
let
function
class
null
debugger
while
var
typeof
indexof
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

Some reserved words

A
boolean
type
catch
false
float
let
null
this
switch
true
typeof
import
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

What is hoisting?

A

Hoisting is JavaScript’s default behavior of moving declarations to the top.

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

A variable has to start with…

A

A variable name must start with a letter, underscore ( _ ), or dollar sign ( $ ). A variable name cannot start with a number.

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

What is instantiation?

A

Process of creating new copies of an object

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

+= will….?

A

Add operands and assign value to the left side
Shorthand for: A = A + B
A += B

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

How to target paretn of all parent files in a frameset?

A

Use top

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

How to evaluate multiple custom objects?

A

Use function

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

Events trigger?

A

functions

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

LiveWire is?

A

A server-side solution

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

Methods operate on ….. instances of an object

A

single

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

alert, prompt and confirm are methods of….

A

the window object

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

Change image on mouseover is an example of…?

A

the image object

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

JS object models groups?

A

3:
browser
language
form fields

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

!== means..

A

not equal to

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

How to clear cookies?

A

Add expiration date thas has already passed

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

parsefloat?

A

converts number to floating point decimal equivalent

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

Variable is…?

A

A space of memory

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

The constructor is….

A

the building block of all custom objects

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

Instantiation is..?

A

create new instances (copies) of the object (once constructor has been defined)

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

Do all browser store cookies the same way?

A

No

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

A sentence on the page (in JS) is an example of..?

A

An object

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

Types of expressions allowed in JS?

A

Assignment
Arithmetic
String
Logical

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

Insert a new line

A

\n

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

What are the event handlers on the select-object?

A

onBlur
onFocus
onChange

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

Operators are used in expressions to…

A

store or return a value

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

Instance

A

real-time objects generated from the empty constructor template

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

What is the main event handler of the button object?

A

onClick

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

Literals are..?

A

the actual data values you provide in JS

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

Logical AND

A

&&

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

Logical OR

A

||

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

Variables can store … date types

A

5

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

A constructor..

A

creates an empty template from which real-time objecst, called instances, can be created

50
Q

Language objects:

A

string
array
date
math

51
Q

The continue statement can only be used in..

A

A for or while loop

52
Q

Some properties of the document object

A
alinkColor
bgColor
cookie
fgColor
createElement
createEvent
getElementsById
getElementsByClassName
querySelectorAll
53
Q

Reflect information on browser being used?

A

Use the navigator object. Brand + version of the browser + users operating system

54
Q

The method toUpperCase() can also be called a function

A

True

55
Q

Most common and functionel use of client side JS?

A

Validate form field submissions

56
Q

When alert and prompt are both used in the same statement the….

A

prompt method will process first

57
Q

To instantiate and then populate the properties of each new instance with actual date, you must…

A

declare variables

58
Q

In order to target a frame, you need to know..

A

A frame’s number in the frames array, or the frame’s name

59
Q

JavaScript is an object … programming language

A

based

60
Q

How to test the presence of cookie?

A

alert(document.cookie);

61
Q

The … method allows you to create text that is dynamically written to the window

A

document.write()

62
Q

Targets the parent of all parents in a frameset?

A

top

63
Q

An argument is…

A

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

64
Q

What would this return? “Sandy Cobb”.charAt(3);

A

D
Index starting at 1 for strings!
! Returns -1 if the value is not found !

65
Q

The document.write method belongs to the …. object

A

document

66
Q

You must declare variables that will become object references to a newly instantiated objects to…

A

instantiate and then populate the properties of each new instance with actual data

67
Q

What is the main event handler for a checkbox?

A

onClick

68
Q

How to appropriate syntax for accessing a function stored in a frame file?

A

relationship.frameName.functionName();

69
Q

alert, prompt adn confirm are examples of…

A

methods

70
Q

An expression is…

A

a part of a statement that is evaluated as a value

71
Q

One domain cannot deposit a cookie for another domain. This would be cross-domain posting and in theroy, is not possible. However, the cross-domain posting rule can be bypassed with the use of shared cookies

A

True

72
Q

The window object is subordinate to the document object in the JavaScript hierarchy.

A

False

73
Q

How to retrieve MIME? Multipurpose Internet Mail Extensions

A

Use encoding (propertie of the form object)

74
Q

A break statement can be used within the…

A

for and while loops

75
Q

Max size for cookie header?

A

4 kb

76
Q

-= is a …. type of operator

A

assignment

77
Q

Constructor = ….

A

A function that defines methods and properties of a custom object used as a template for instances of the custom object

78
Q

How to change two frames simultaneaously in JS?

A

Write a function that inclused two or more location.href statements

79
Q

The first character of a variable must be a letter or an underscore, but subsequent characters can be letters, numbers, and the underscore character.

A

True

80
Q

Which information is required to generate a cookie?

A

The nam=value pair is the only required information

81
Q

What is a fundamentel problem with JS web sites?

A

Scripts can generate security problems or infinite loops IF written incorrectly

82
Q

Which action can be performed by an object?

A

Method

83
Q

Example how to escapte quotations marks..

A
var ssingleQ = 'It\'s nine o\' clock in the morning.';  
var doubleQ = "Mukesh Ambani is \"the richest man\" of India.";
84
Q

When using frames, where should functions and variables be stored in a JavaScript-based Web site?

A

In any HTML file that is invoked in making the frameset

85
Q

Consider the following HTML: <tt></tt> Which method of the String object is used to write the JavaScript equivalent to this HTML?

A

fixed()

86
Q

In which part of the HTTP communication protocol does the cookie initially begin to function?

A

in the HTTP response header

87
Q

Consider the following HTML: Which method of the String object is used to write the JavaScript equivalent to this HTML?

A

italic()

88
Q

Which property of the form object is a string value that contains the name of the window or frame to which responses to form submissions are directed?

A

target

89
Q

Which JavaScript object should be used to create buttons that animate whenever the mouse pointer passes over them?

A

image

90
Q

Which property of the document object represents the color in which text is to be displayed?

A

fgColor

91
Q

Which string value contains the name of the client used to access a page under the navigator object (i.e., Netscape for Netscape Navigator)?

A

AppName

92
Q

Which property of the location object refers to the hostname:port solution of the URL?

A

host

93
Q

Which method of the String object would you use when writing the name of a chemical compound, such as “H20”?

A

sub()

94
Q

What is a constructor function in JavaScript?

A

A special function that allows the construction of object s

95
Q

Which property of the form object describes the URL to which the form data is submitted?

A

action

96
Q

What is the primary difference between method and functions when working with custom JavaScript objects?

A

Methods work with single instances of objects. Functions can work on all instances of an object

97
Q

Describe JavaScript

A

Interpret at run time, and NOT compiled

98
Q

Nadir has created several new instances of custom objects. How can he now allow access to this information with a Web browser?

A

He must create an object method that allows the viewing of the object

99
Q

Which property of the form object represents the identity of the form as defined in the tag?

A

name

100
Q

Which method of the String object would you use when writing a complex mathematical formula in JavaScript that includes powers, such as “E=MC2”?

A

small()

101
Q

Can a cookie identify a user to a Web site even if that user has never submitted personal information to that site?

A

Only if the user visited a site that uses shared cookies

102
Q

Which property of the location object specifies the internal link anchor name, which is followed by the number sign (#) in the URL?

A

hash

103
Q

Tanja needs to examine only a small portion of a string. Which JavaScript method should she use to perform this task?

A

substring()

104
Q

Describe how cookies are stored on a user’s hard drive?

A

Depending on the browser type, cookies are stored as text strings in directories

105
Q

Can the practice of calling JavaScript functions from framesets be extended to calling them from different browser windows?

A

yes

106
Q

When using custom JavaScript objects, why should you use arrays of instantiate each object individually?

A

Arrays are more flexible and indexed thus repetitive tasks are easier to handle

107
Q

Which is the JavaScript property that is used to inform a script that an image has finished loading?

A

complete

108
Q

Which property of the navigator object identifies the operating system for which the browser was compiled?

A

userAgent

109
Q

Can a programmer refer to a variable from anywhere in a frameset?

A

Yes

110
Q

Term for a single line of JavaScript code that is executed in a script or program?

A

statement

111
Q

How many cookies are permitted per domain on a user’s hard drive?

A

Twenty cookies per domain

112
Q

Which special character in JavaScript is interpreted as a tab?

A

\t

113
Q

In JavaScript, objects possess?

A

properties and methods

114
Q

Several different types of JavaScript objects exist, such as String, Math, Array, and Date. What are these types of objects called?

A

language

115
Q

Which property of the location object specifies the full URL of a file or site?

A

href

116
Q

Wilhelm is writing a constructor in JavaScript. He uses the word “this” when referring to the properties and methods in his object parameters and functions. Why?

A

The this keyword is used to represent the object as the properties and methods are defined

117
Q

Which property of the location object specifies whether HTTP or FTP is being used?

A

protocol

118
Q

What is the JavaScript term for a string value that represents the URL of the document from which the current document was accessed?

A

referrer

119
Q

In Microsoft Internet Explorer, what is the purpose of the DAT file?

A

The DAT file is used in caching, sometimes in tandem with cookies.txt

120
Q

If no element exists (using the getElementById) what is the return?

A

null

121
Q

Whitespaces are treated as…. (DOM)

A

text node

122
Q

Some methods of the history object (window.history)

A

history. back() - same as clicking back in the browser

history. forward() - same as clicking forward in the browser