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
Events trigger?
functions
26
LiveWire is?
A server-side solution
27
Methods operate on ..... instances of an object
single
28
alert, prompt and confirm are methods of....
the window object
29
Change image on mouseover is an example of...?
the image object
30
JS object models groups?
3: browser language form fields
31
!== means..
not equal to
32
How to clear cookies?
Add expiration date thas has already passed
33
parsefloat?
converts number to floating point decimal equivalent
34
Variable is...?
A space of memory
35
The constructor is....
the building block of all custom objects
36
Instantiation is..?
create new instances (copies) of the object (once constructor has been defined)
37
Do all browser store cookies the same way?
No
38
A sentence on the page (in JS) is an example of..?
An object
39
Types of expressions allowed in JS?
Assignment Arithmetic String Logical
40
Insert a new line
\n
41
What are the event handlers on the select-object?
onBlur onFocus onChange
42
Operators are used in expressions to...
store or return a value
43
Instance
real-time objects generated from the empty constructor template
44
What is the main event handler of the button object?
onClick
45
Literals are..?
the actual data values you provide in JS
46
Logical AND
&&
47
Logical OR
||
48
Variables can store ... date types
5
49
A constructor..
creates an empty template from which real-time objecst, called instances, can be created
50
Language objects:
string array date math
51
The continue statement can only be used in..
A for or while loop
52
Some properties of the document object
``` alinkColor bgColor cookie fgColor createElement createEvent getElementsById getElementsByClassName querySelectorAll ```
53
Reflect information on browser being used?
Use the navigator object. Brand + version of the browser + users operating system
54
The method toUpperCase() can also be called a function
True
55
Most common and functionel use of client side JS?
Validate form field submissions
56
When alert and prompt are both used in the same statement the....
prompt method will process first
57
To instantiate and then populate the properties of each new instance with actual date, you must...
declare variables
58
In order to target a frame, you need to know..
A frame's number in the frames array, or the frame's name
59
JavaScript is an object ... programming language
based
60
How to test the presence of cookie?
alert(document.cookie);
61
The ... method allows you to create text that is dynamically written to the window
document.write()
62
Targets the parent of all parents in a frameset?
top
63
An argument is...
a value or expression containing data or code that is passed on to a function or procedure
64
What would this return? "Sandy Cobb".charAt(3);
D Index starting at 1 for strings! ! Returns -1 if the value is not found !
65
The document.write method belongs to the .... object
document
66
You must declare variables that will become object references to a newly instantiated objects to...
instantiate and then populate the properties of each new instance with actual data
67
What is the main event handler for a checkbox?
onClick
68
How to appropriate syntax for accessing a function stored in a frame file?
relationship.frameName.functionName();
69
alert, prompt adn confirm are examples of...
methods
70
An expression is...
a part of a statement that is evaluated as a value
71
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
True
72
The window object is subordinate to the document object in the JavaScript hierarchy.
False
73
How to retrieve MIME? Multipurpose Internet Mail Extensions
Use encoding (propertie of the form object)
74
A break statement can be used within the...
for and while loops
75
Max size for cookie header?
4 kb
76
-= is a .... type of operator
assignment
77
Constructor = ....
A function that defines methods and properties of a custom object used as a template for instances of the custom object
78
How to change two frames simultaneaously in JS?
Write a function that inclused two or more location.href statements
79
The first character of a variable must be a letter or an underscore, but subsequent characters can be letters, numbers, and the underscore character.
True
80
Which information is required to generate a cookie?
The nam=value pair is the only required information
81
What is a fundamentel problem with JS web sites?
Scripts can generate security problems or infinite loops IF written incorrectly
82
Which action can be performed by an object?
Method
83
Example how to escapte quotations marks..
``` var ssingleQ = 'It\'s nine o\' clock in the morning.'; var doubleQ = "Mukesh Ambani is \"the richest man\" of India."; ```
84
When using frames, where should functions and variables be stored in a JavaScript-based Web site?
In any HTML file that is invoked in making the frameset
85
Consider the following HTML: Which method of the String object is used to write the JavaScript equivalent to this HTML?
fixed()
86
In which part of the HTTP communication protocol does the cookie initially begin to function?
in the HTTP response header
87
Consider the following HTML: Which method of the String object is used to write the JavaScript equivalent to this HTML?
italic()
88
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?
target
89
Which JavaScript object should be used to create buttons that animate whenever the mouse pointer passes over them?
image
90
Which property of the document object represents the color in which text is to be displayed?
fgColor
91
Which string value contains the name of the client used to access a page under the navigator object (i.e., Netscape for Netscape Navigator)?
AppName
92
Which property of the location object refers to the hostname:port solution of the URL?
host
93
Which method of the String object would you use when writing the name of a chemical compound, such as “H20”?
sub()
94
What is a constructor function in JavaScript?
A special function that allows the construction of object s
95
Which property of the form object describes the URL to which the form data is submitted?
action
96
What is the primary difference between method and functions when working with custom JavaScript objects?
Methods work with single instances of objects. Functions can work on all instances of an object
97
Describe JavaScript
Interpret at run time, and NOT compiled
98
Nadir has created several new instances of custom objects. How can he now allow access to this information with a Web browser?
He must create an object method that allows the viewing of the object
99
Which property of the form object represents the identity of the form as defined in the tag?
name
100
Which method of the String object would you use when writing a complex mathematical formula in JavaScript that includes powers, such as “E=MC2”?
small()
101
Can a cookie identify a user to a Web site even if that user has never submitted personal information to that site?
Only if the user visited a site that uses shared cookies
102
Which property of the location object specifies the internal link anchor name, which is followed by the number sign (#) in the URL?
hash
103
Tanja needs to examine only a small portion of a string. Which JavaScript method should she use to perform this task?
substring()
104
Describe how cookies are stored on a user’s hard drive?
Depending on the browser type, cookies are stored as text strings in directories
105
Can the practice of calling JavaScript functions from framesets be extended to calling them from different browser windows?
yes
106
When using custom JavaScript objects, why should you use arrays of instantiate each object individually?
Arrays are more flexible and indexed thus repetitive tasks are easier to handle
107
Which is the JavaScript property that is used to inform a script that an image has finished loading?
complete
108
Which property of the navigator object identifies the operating system for which the browser was compiled?
userAgent
109
Can a programmer refer to a variable from anywhere in a frameset?
Yes
110
Term for a single line of JavaScript code that is executed in a script or program?
statement
111
How many cookies are permitted per domain on a user’s hard drive?
Twenty cookies per domain
112
Which special character in JavaScript is interpreted as a tab?
\t
113
In JavaScript, objects possess?
properties and methods
114
Several different types of JavaScript objects exist, such as String, Math, Array, and Date. What are these types of objects called?
language
115
Which property of the location object specifies the full URL of a file or site?
href
116
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?
The this keyword is used to represent the object as the properties and methods are defined
117
Which property of the location object specifies whether HTTP or FTP is being used?
protocol
118
What is the JavaScript term for a string value that represents the URL of the document from which the current document was accessed?
referrer
119
In Microsoft Internet Explorer, what is the purpose of the DAT file?
The DAT file is used in caching, sometimes in tandem with cookies.txt
120
If no element exists (using the getElementById) what is the return?
null
121
Whitespaces are treated as.... (DOM)
text node
122
Some methods of the history object (window.history)
history. back() - same as clicking back in the browser | history. forward() - same as clicking forward in the browser