summaryrefslogtreecommitdiffstats
path: root/jsnotes.txt
diff options
context:
space:
mode:
Diffstat (limited to 'jsnotes.txt')
-rw-r--r--jsnotes.txt41
1 files changed, 41 insertions, 0 deletions
diff --git a/jsnotes.txt b/jsnotes.txt
new file mode 100644
index 0000000..d28e473
--- /dev/null
+++ b/jsnotes.txt
@@ -0,0 +1,41 @@
+[references]
+http://msdn.microsoft.com/en-us/library/ie/d1et7k7c%28v=vs.94%29.aspx
+
+[data types]
+- primitive
+ string, number boolean
+
+- composite (reference)
+ object, array
+
+ rvalues: new Object(), Object(), function() {}, {}
+ rvalues: [], new Array(), Array()
+
+- special
+ null, undefined
+ note: null is not 0, does not have type, undefined is a string
+
+[anonymous functions]
+wrapping code inside of 'function() { code } ()' is handy for creating a
+namespace for your code and restricting scope, since js essentially has
+a global and function scope, we don't want to pollute and cause collisons
+
+[closures]
+in JavaScript, if you use the function keyword inside another function, you are
+creating a closure. if a function containing function f returns that function,
+that variable points to f and also to the closure, unlike C, where stack frame
+would get destroyed, so f has access to variables/object in the context it was
+defined in
+
+- what about function returning a function
+ that's a good way to leverage closures!
+
+['this' and 'prototype' object and the 'new']
+- every object has a prototype object
+- the keyword 'this' refers to the object context within which the
+ the function is executing
+- protype is used for templating, it provides access to members of an object,
+ when function is assigned to this object, only 1 copy exists, it is memory
+ efficient, also we get expected behavior when overriding that function
+- 'new' changes meaning of a function, upon invocation, function is ran in blank
+ object context \ No newline at end of file