Title: Theory / Important / CS / Programming / JS / The good part / Awful
Tags: computer_to_instruction récupéré hasNotNewEffectReturnsMeaning FromInstruction automatedNewLineAfterCommaSpace declaration fromCommandLine

Question: Why to avoid global variable
Answer: Two parts will use the same variable name, and interact by accident
Page: 101
Chapter: A

Instruction: A variable, out of a function, or not declared with "var"
Page: A
Meaning: global variable
Language: js
Section: 101

Question: Why not to place { on new line
Answer: Semicolon assertion will put a semicolon before {, changing its meaning
Page: 102
Chapter: A
Context: JS

Instruction: foo == null
Page: A
Language: js
Section: 102
Returns: whether foo's value is null
Variables: foo an expression

Instruction: foo!=null && typeof my_value ==='object'
Page: A
Language: js
Section: 102
Returns: whether foo's value is an object
Variables: foo an expression

Instruction: parseint(
  foo,
  bar
)
Page: A
Language: js
Section: 104
Returns: The value of the first integer in the string foo, interpreted in radix bar

Question: Why one should always indicate parseInt's radix ?
Answer: Otherwise, "078" is considered as the base 8 number 7, and 8 is ignored
Page: 104
Chapter: A

Question: What to do to add numbers ?
Answer: Be sure that parameters are numbers, and not a string representation of it
Page: 104
Chapter: A

Question: how to do arithmetic with a fixed number \(n\) of digit after the dot ?
Answer: Scale, by multiplying numbers by \(10^n\). (And divide/multiply by \(10^n\) after each multiplication/before each division.)
Page: 104
Chapter: A

Instruction: A number obtained after a division by 0, or converting a string to number when its not a representation of a number
Page: A
Effect: NaN
Language: js
Section: 105
Intuition: Not a Number
Other fields (not shown on cards):
Etymology: number

Question: What is the result of an arithmetic operation using NaN as an argument ?
Answer: NaN
Page: 105
Chapter: A

Instruction: isNaN(foo)
Page: A
Language: js
Section: 105
Returns: Whether foo interpreted as a number, is NaN

Instruction: isFinite(foo)
Page: A
Language: js
Section: 105
Returns: Whether foo interpreted as a number, is neither NaN nor Infinite

Page: A
Implementation: var isNumber = function isNumber(value) {
  return typeof value === 'number' && isFinite(value);
}
Section: 105
Effect: Whether foo is a number, nor infinite nor NaN
Language: js
Instruction: isNumber(foo)

Instruction: the value of a missing member in an object
Page: A
Effect: undefined
Language: js
Section: 106

Instruction: JSlint
Page: C
Effect: checks for common javascript error
Language: js
Section: 115

Instruction: /*global foo_1, ..., foo_n*/
Page: C
Effect: states that the variables foo_i are global,
Language: JSlint
Section: 116

Instruction: /*members foo_1, ..., foo_n*/
Page: C
Effect: states that each member is one of the foo_i, everything else should be considered as a typo
Language: JSlint
Section: 117

Instruction: /*jslint foo_1:v_1, ..., foo_n: v_n*/
Page: C
Effect: states that jslint should uses the part of the language foo_i if v_i is true, and not use it if its false
Language: JSlint
Section: 117

Instruction: omitted
Page: C
Effect: list of jslint option
Language: JSlint
Section: 117

Page: A
Implementation: var isNumber = function isNumber(value) {
   return typeof value === 'number' &&
   isFinite(value);
}
Section: 105
Language: js
Returns: Whether foo is a number, nor infinite nor NaN
Instruction: isNumber(foo)