Please enable JavaScript.
Coggle requires JavaScript to display documents.
JavaScript - Coggle Diagram
JavaScript
Language
Defintions
-
-
Bits: Any two valued entity, usually described by 0 and 1
-
Binding/ Variable: Assignment of a value to a name. The name like a tentacle grasps the value. Two bindings can grasp the same value.
Scope: The part of the program in which the binding is visible. Can be nested, functions and blocks{} will be a scope
-
-
-
-
-
-
Identity: Two objects grasping the same value have the same identity. E.g.
let object1 = {value: 10}
let object2 = object1
-
-
-
-
-
-
== When one side of a comparison is null or undefined the other side also needs to be null or undefined for it to be true
0, NaN, undefined, null, “” count as false, everything else will return true
-
-
&& will return the value on it’s left when it’s false, else it will return the value on the rigth
Automatic Type Conversion: JS will automatically convert values to the type it needs based on a set of rulles
-
-
-
Usefull functions
-
Arrays: let array = [1,2,3]
-
-
-
-
-
array.indexOf(element): returns the index at which an element was found and -1 when no element was found
indexOf begins at the front of an array, .lastIndexOf(element) starts at the back
array.slice(startIndex, endIndex): will return a copy of the original array beginning and ending at the specified indices. If either startIndex or endIndex is left blank the copy will beginn at the start/ end of the original
-
Objects: let object = { x: 1, y: 2}
-
-
Object.keys(object) : hand Object.keys() an object and it will return an array with the names of all of the objects properties
Object.assign(object, object): Copies all of the properties of object2 into object1
String
-
-
-
string.padStart(stringLengthWithPadding, paddingString): will return the string where the string has been padded with the handed paddingString for the given amount. e.g “hey”.padStart(6, “0”); —> 000hey
string.split(subString): returns array with substrings. E.g. “A B C”.split(“ “) —> [ “A”, “B”, “C”]
array.join(insertString): joins array of substrings into one sting where the insertString acts as glue
-
-
-