JavaScript Flashcards

1
Q

What is the purpose of variables?

A

To store data into

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

How do you declare a variable?

A

var variable name;

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

How do you initial (assign a value to) a variable?

A

=

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

What characters are allowed in variable names?

A

Letters, numbers, &, _

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

What does it mean to say that variable names are “case sensitive?”

A

Variables of the same name have to be typed with the same capitalization

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

What is the purpose of a string?

A

Store or manipulate text

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

What is the purpose of a number?

A

Store or manipulate numbers

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

What is the purpose of a boolean?

A

Data type showing binary states, true/false

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

What does the = operator mean in JavaScript?

A

Assigning a value to a variable

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

How do you update the value of a variable?

A

Reassign variable to a new value

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

What is the difference between null and undefined?

A

Null: non-existent or invalid object, null cannot be created unorganically, purposeful emptiness
Undefined: assigned to a variable with nothing

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

Why is it a good habit to include “labels” when you log values to the browser?

A

More clear which variables are being logged and in what order

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

Give five examples of JavaScript primitives

A

String, number, bigint, boolean, undefined, symbol, null

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

What data type is returned by an arithmetic operation?

A

Number

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

What is string concatenation?

A

The joining of two or more strings to create on string

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

What purpose(s) does the + plus operator serve in JavaScript?

A

Adding one value to another

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

What data type is returned by comparing two values (, ===, etc)?

A

Boolean

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

What does the += “plus-equals” operator do?

A

Add the value of the right operand to a variable and assigns the result to a variable

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

What are objects used for?

A

Groups a set of variables and functions

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

What are object properties?

A

Variables within a certain boundary in a storage location

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

Describe object literal notation

A

{ property: value, }

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

How do you remove a property from an object?

A

Delete

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

What are the two ways to get or update the value of a property?

A

Dot notation, bracket notation

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

What are arrays used for?

A

Stores a list of values

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

Describe array literal notation

A

[ variable1, variable 2, variable3]

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

How are arrays different from “plain” objects?

A

Instead of properties, arrays have index number for values

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

What number represents the first index of an array?

A

0

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

What is the length property of an array?

A

Total number of values

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

How do you calculate the last index of an array?

A
Create new variable (last index), assign to the result of length of array (number of students) minus 1. 
Create new variable (last student), assign to original array at the index of the new variable (last index).
var lastIndex = numberOfStudents - 1;
var lastStudent = students[lastIndex];
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
30
Q

What is a function in JavaScript?

A

Reusable block of code

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

Describe the parts of a functiondefinition.

A

Name of a function, parameters code block

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

Describe the parts of a functioncall.

A

Name of the function, parentheses, argument

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

When comparing them side-by-side, what are the differences between a functioncalland a functiondefinition?

A

Function has keyword, code block and parameter

Call has a name and arguments

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

What is the difference between aparameterand anargument?

A

Parameter- placeholder

Argument- variable

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

Why are functionparametersuseful?

A

Act as a placeholder

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

What two effects does areturnstatement have on the behavior of a function?

A
  1. Causes the function to produce a value we can use in our program.
  2. Prevents any more code in the function’s code block from being run.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
37
Q

Why do we log things to the console?

A

Debugging tool

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

What is a method?

A

Functions being called of an object

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

How is a method different from any other function?

A

Method is associated with an object

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

How do you remove the last element from an array?

A

Pop

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

How do you round a number down to the nearest integer?

A

Math.floor

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

How do you generate a random number?

A

Math.random

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

How do you delete an element from an array?

A

Splice

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

How do you append an element to an array?

A

Push

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

How do you break a string up into an array?

A

Split

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

Do string methods change the original string? How would you check if you weren’t sure?

A

No, console.log

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

Is the return value of a function or method useful in every situation?

A

No

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

What three-letter acronym should you always include in your Google search about a JavaScript method or CSS property?

A

MDN

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

Give 6 examples of comparison operators.

A

greater than, less than, ==, ===, !=, !==, <=, >=

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

What data type do comparison expressions evaluate to?

A

Boolean

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

What is the purpose of anifstatement?

A

Having your code make a decision

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

Iselserequired in order to use anifstatement?

A

No

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

Describe the syntax (structure) of anifstatement.

A

If (condition) {
execute
}

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

What are the three logical operators?

A

&&, | |, !

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

How do you compare two different expressions in the same condition?

A

Logical operators

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

What is the purpose of a loop?

A

To repeat a portion of code a set amount of times

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

What is the purpose of aconditionexpression in a loop?

A

An expression that is tested every time a code loops

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

What does “iteration” mean in the context of loops?

A

One repetition of a code block

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

Whendoes theconditionexpression of awhileloop get evaluated?

A

Before the code block runs

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

Whendoes theinitializationexpression of aforloop get evaluated?

A

Before anything

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

Whendoes theconditionexpression of aforloop get evaluated

A

Before each iteration

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

Whendoes thefinalexpression of aforloop get evaluated?

A

After each iteration

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

Besides areturnstatement, which exits its entire function block, which keyword exits a loop before itsconditionexpression evaluates tofalse?

A

Break

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

What does the++increment operator do?

A

Increment by 1

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

How do you iterate through the keys of an object

A

Use a for-in loop

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

What are the four components of “the Cascade”.

A

Source order, inheritance, specificity & !important

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

What does the term “source order” mean with respect to CSS?

A

The styling provided for an element last in your stylesheet is the styling that will ultimately take effect

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

How is it possible for the styles of an element to be applied to its children as well without an additional CSS rule

A

Inheritance

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

List the three selector types in order of increasing specificity.

A

Type, class, id

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

Why is using!importantconsidered bad practice?

A

It makes debugging more difficult by breaking the natural cascading in stylesheets

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

Why do we log things to the console?

A

Debugging tool

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

What is a “model”?

A

A representation of something

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

Which “document” is being referred to in the phrase Document Object Model?

A

The whole html file

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

What is the word “object” referring to in the phrase Document Object Model?

A

The datatype object

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

What is a DOM Tree?

A

Element plus all of its children

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

Give two examples ofdocumentmethods that retrieve a single element from the DOM.

A

queryselector, getelementbyname

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

Give one example of adocumentmethod that retrieves multiple elements from the DOM at once.

A

queryselectorall

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

Why might you want to assign the return value of a DOM query to a variable?

A

Ease of logging

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

Whatconsolemethod allows you to inspect the properties of a DOM element object?

A

console.dir

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

Why would atag need to be placed at the bottom of the HTML content instead of at the top?

A

Because the html isn’t rendered yet

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

What doesdocument.querySelector()take as its argument and what does it return?

A

String, first element in the document with its name

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

What doesdocument.querySelectorAll()take as its argument and what does it return?

A

Object, node list

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

What is the purpose of events and event handling?

A

To show the action resulting from a user, the code executed once the event takes place

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

Are all possible parameters required to use a JavaScript method or function?

A

No

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

What method of element objects lets you set up a function to be called when a specific type of event occurs?

A

addEventListener

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

What is a callback function

A

Function passed into another function as an argument

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

What object is passed into an event listener callback when the event fires?

A

Event

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

What is theevent.target? If you weren’t sure, how would you check? Where could you get more information about it?

A

Where the event occurred in the DOM, console.log it, MDN

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

What is theclassNameproperty of element objects?

A

Gets and sets the value of the class attribute of the element

90
Q

How do you update the CSS class attribute of an element using JavaScript

A

Query select element and assign to class name property

91
Q

What is thetextContentproperty of element objects

A

The text content of its’ elements

92
Q

How do you update the text within an element using JavaScript?

A

Query select the element and assign to text content property

93
Q

Is theeventparameter of an event listener callback always useful?

A

No

94
Q

Why is storing information about a program in variables better than only storing it in the DOM?

A

Variables can be used again anywhere in the JavaScript file

95
Q

What event is fired when a user places their cursor in a form control?

A

Focus

96
Q

What event is fired when a user’s cursor leaves a form control?

A

Blur

97
Q

What event is fired as a user changes the value of a form control

A

Input

98
Q

What event is fired when a user clicks the”submit”button within aform?

A

Submit

99
Q

What does theevent.preventDefault()method do?

A

Prevents usual behavior of that object

100
Q

What does submitting a form withoutevent.preventDefault()do?

A

Refreshes the page

101
Q

What property of a form element object contains all of the form’s controls.

A

Element

102
Q

What property of a form control object gets and sets its value?

A

Value

103
Q

What is one risk of writing a lot of code without checking to see if it works so far?

A

Harder to debug

104
Q

What is an advantage of having your console open when writing a JavaScript program?

A

Debugging

105
Q

Does thedocument.createElement()method insert a new element into the page?

A

No

106
Q

How do you add an element as a child to another element?

A

appendChild

107
Q

What do you pass as the arguments to theelement.setAttribute()method?

A

Name, value

108
Q

What steps do you need to take in order to insert a new element into the page?

A

Create new element, setAttributes, appendChild

109
Q

What is thetextContentproperty of an element object for?

A

To change/insert text content of an element

110
Q

Name two ways to set theclassattribute of a DOM element.

A

setAttribute, className

111
Q

What are two advantages of defining a function to do create something (like the work of creating a DOM tree)?

A

reusing it, name recognition

112
Q

What is theevent.target?

A

The element to which the event is dispatched

113
Q

Why is it possible to listen for events on one element that actually happen its descendent elements?

A

Event capturing

114
Q

What DOM element property tells you what type of element it is

A

event.target.tagName

115
Q

What does theelement.closest()method take as its argument and what does it return?

A

Closest ancestor element

116
Q

How can you remove an element from the DOM

A

Remove

117
Q

If you wanted to insert new clickable DOM elements into the page using JavaScript, how could you avoid adding an event listener to every new element individually?

A

Add event listener to direct ancestor of element

118
Q

What is the affect of setting an element todisplay: none

A

Hiding the element

119
Q

What does theelement.matches()method take as an argument and what does it return?

A

Takes in a selector string, returns a boolean

120
Q

How can you retrieve the value of an element’s attribute?

A

getAttribute

121
Q

At what steps of the solution would it be helpful to log things to the console?

A

Checking variables in the loop

122
Q

If you were to add another tab and view to your HTML, but you didn’t use event delegation, how would your JavaScript code be written instead?

A

Adding an event listener to every single object

123
Q

If you didn’t use a loop to conditionally show or hide the views in the page, how would your JavaScript code be written instead?

A

Separate conditional blocks for each view

124
Q

What is JSON?

A

JavaScript Object Notation

125
Q

What are serialization and deserialization?

A

Turning an object in memory into a stream of bytes so you can do stuff like store it on disk or send it over the network
Turning a stream of bytes into an object in memory

126
Q

Why are serialization and deserialization useful?

A

Preserving the data

Using the data

127
Q

How do you serialize a data structure into a JSON string using JavaScript?

A

JSON.stringify

128
Q

How do you deserialize a JSON string into a data structure using JavaScript?

A

JSON.parse

129
Q

How to you store data inlocalStorage?

A

localStorage.setItem

130
Q

How to you retrieve data fromlocalStorage?

A

localStorage.getItem

131
Q

What data type canlocalStoragesave in the browser?

A

String

132
Q

When does the’beforeunload’event fire on thewindowobject?

A

Before the page unloads

133
Q

What is amethod?

A

A function which is a property of an object

134
Q

How can you tell the difference between a methoddefinitionand a methodcall?

A

Method definition is the reusable code to be executed

Method call is when the code is executed

135
Q

Describe methoddefinitionsyntax (structure).

A

{
methodproperty: value},

136
Q

Describe methodcallsyntax (structure).

A

Object.method(argument);

137
Q

How is a method different from any other function?

A

A method is called of an object

138
Q

What is thedefining characteristicof Object-Oriented Programming?

A

Having objects that can contain both data (as properties) and behavior (as methods)

139
Q

What are the four “principles” of Object-Oriented Programming?

A

Abstraction, encapsulation, inheritance, polymorphism

140
Q

What is “abstraction”?

A

Working with complex things in simple ways

141
Q

What does API stand for?

A

Application programming interface

142
Q

What is the purpose of an API?

A

Offer a service to other pieces of software

143
Q

What is’this’in JavaScript?

A

An implicit parameter

144
Q

What does it mean to say that’this’is an “implicit parameter”?

A

Available in function’s code block even though it was never included in function’s parameter list or never declared

145
Q

Whenis the value ofthisdetermined in a function;call timeordefinition time

A

Call time

146
Q

How can you tell what the value of’this’will be for a particular function or methoddefinition?

A

‘this’ is nothing

147
Q

How can you tell what the value of’this’is for a particular function or methodcall?

A

Object to the left of the dot, if no dot, it’s window

148
Q

What kind of inheritance does the JavaScript programming language use?

A

Prototype-based inheritance

149
Q

What is a prototype in JavaScript?

A

An object that contains properties and methods that can be used by other objects.

150
Q

How is it possible to call methods on strings, arrays, and numbers even though those methods don’t actually exist on strings, arrays, and numbers

A

They inherit it from a prototype object

151
Q

If an object does not have its’ own property or method by a given key, where does JavaScript look for it?

A

In the prototypes

152
Q

What does thenewoperator do?

A

Creates a blank object, adds a __proto__ property to the new object, gives ‘this’ variable a value, return ‘this’

153
Q

What property of JavaScript functions can store shared behavior for instances created withnew

A

Prototype

154
Q

What does theinstanceofoperator do?

A

Checks if value on right is present in value on left

155
Q

What is a “callback” function?

A

A function passed into another function as an argument

156
Q

Besides adding an event listener callback function to an element or thedocument, what is one way to delay the execution of a JavaScript function until some point in the future?

A

setTimeout

157
Q

How can you set up a function to be called repeatedly without using a loop?

A

setInterval

158
Q

What is the default time delay if you omit thedelayparameter fromsetTimeout()orsetInterval()?

A

0

159
Q

What dosetTimeout()andsetInterval()return?

A

Positive integer value

160
Q

What is a client?

A

Piece of computer software/hardware that accesses a service by available by a server

161
Q

What is a server?

A

Piece of computer software/hardware that provides functionality for other programs or devices

162
Q

Which HTTP method does a browser issue to a web server when you visit a URL?

A

Get

163
Q

What three things are on the start-line of an HTTPrequestmessage?

A

HTTP method, request target/URL, HTTP version

164
Q

What three things are on the start-line of an HTTPresponsemessage

A

Protocol version, status code, status text

165
Q

What are HTTP headers?

A

Metadata of an http message

166
Q

Where would you go if you wanted to learn more about a specific HTTP Header?

A

MDN

167
Q

Is a body required for a valid HTTP request or response message?

A

No

168
Q

What is AJAX?

A

Allows you to request data from a server and load it without having to refresh the entire page

169
Q

What does the AJAX acronym stand for?

A

Asynchronous JavaScript And XML

170
Q

Which object is built into the browser for making HTTP requests in JavaScript?

A

XMLHttpRequest

171
Q

What event is fired byXMLHttpRequestobjects when they are finished loading the data from the server

A

Load

172
Q

AnXMLHttpRequestobject has anaddEventListener()method just like DOM elements. How is it possible that they both share this functionality?

A

They both share the same event.target.prototype

173
Q

What is a code block? What are some examples of a code block?

A

A group of statements delimited by a pair of curly braces


Function code blocks

174
Q

What does block scope mean?

A

When a variable is defined within a block, not accessible outside a block

175
Q

What is the scope of a variable declared withconstorlet?

A

Block scope

176
Q

What is the difference betweenletandconst?

A

Let can be reassigned

Const cannot be reassigned

177
Q

Why is it possible to.push()a new value into aconstvariable that points to anArray?

A

When you add to an array, you’re not reassigning the value of an array, you’re adding to the list of the array

178
Q

How should you decide on which type of declaration to use?

A

If you want a value to be immutable, use const

If you want a value to be able to be reassigned, use let

179
Q

What is the syntax for writing a template literal?

A

A string enclosed by back ticks

180
Q

What is “string interpolation”?

A

The ability to substitute a part of the string for values of variables or expressions

181
Q

What is destructuring, conceptually?

A

Breaking down an object, assigning the values of the object/array to variables

182
Q

What is the syntax forObjectdestructuring?

A

let { property1: variable1, property2: variable2 } = object;

183
Q

What is the syntax forArraydestructuring

A

let [x, y, z] = array;

184
Q

How can you tell the difference between destructuring and creatingObject/Arrayliterals

A

Destructuring has curly braces on left side of =

Creating has curly braces on right side of =

185
Q

What is the syntax for defining an arrow function?

A

Const fnName = () => {}
If there’s only one parameter, you don’t need parentheses
Zero parameters, or two or more parameters, parentheses are mandatory

186
Q

When an arrow function’s body is left without curly braces, what changes in its functionality?

A

Automatically returned

187
Q

How is the value ofthisdetermined within an arrow function?

A

Determined at definition time

188
Q

What is a CLI?

A

Command line interfaces, commands to a computer program in the form of lines of text

189
Q

What is a GUI?

A

Graphical user interface, form of user interface that allows users to interact with electronic devices through graphical icons and audio indicators instead of text-based user interfaces

190
Q

Command ‘man’

A

Interface to the online reference manuals

191
Q

Command ‘cat’

A

Concatenate files and print the output

192
Q

Command ‘ls’

A

List information about files

193
Q

Command ‘pwd’

A

Print name of current/working directory

194
Q

Command ‘echo’

A

Display line of text

195
Q

Command ‘touch’

A

Update the access and modification times of each file to current time

196
Q

Command ‘mkdir’

A

Create directories that don’t already exist

197
Q

Command ‘mv’

A

Move or rename files

198
Q

Command ‘rm’

A

Remove files or directories

199
Q

Command ‘cp’

A

Copy files and directories

200
Q

What are the three virtues of a great programmer?

A

Laziness, impatience, hubris

201
Q

What is Node.js?

A

JavaScript runtime, executing JavaScript code not in a browser

202
Q

What can Node.js be used for?

A

Used for back-end services and to build scalable network applications

203
Q

What is a REPL?

A

Read-Eval-Print-Loop, program running a programming language awaiting additional inputs

204
Q

When was Node.js created

A

2009

205
Q

What back end languages have you heard of?

A

Python, php, ruby, java, c++, C#, rust, golang, perl, visual basic, elixir, haskell, rust, Clojure, kotlin, wasm

206
Q

What is theprocessobject in a Node.js program?

A

Global variable that provides information about, and control over, the current Node.js process

207
Q

How do you access theprocessobject in a Node.js program?

A

Open node.js or explicitly access using require(‘process’)

208
Q

What is the data type ofprocess.argvin Node.js?

A

Array

209
Q

What is a JavaScript module?

A

Functionality organized in javascript files which can be reused throughout the node

210
Q

What values are passed into a Node.js module’s local scope?

A

module, exports, require, __filename, __dirname

211
Q

Give two examples oftrulyglobal variables in a Node.js program.

A

Global, process, setTimeout, setInternal

212
Q

What is the purpose ofmodule.exportsin a Node.js module?

A

To export code from a given file to another file that can access its’ code

213
Q

How do you import functionality into a Node.js module from another Node.js module?

A

Require.(‘./relative-path’)

214
Q

What is the JavaScript Event Loop?

A

Runtime model that executes code, collects and processes events, executes queued sub-tasks

215
Q

What is different between “blocking” and “non-blocking” with respect to how code is executed

A

Blocking runs code in sequence, non-blocking runs parallel

216
Q

What is a directory

A

A folder that has a collection of files

217
Q

What is a relative file path?

A

Location of file or folder relative to the working directory

218
Q

What is an absolute file path?

A

Complete location of file or folder relative to the root directory

219
Q

What module does Node.js include for manipulating the file system?

A

fs module

220
Q

What method is available in the Node.jsfsmodule for writing data to a file?

A

writeFile()

221
Q

Are file operations using thefsmodule synchronous or asynchronous?

A

Yes