JavaScript provides seven different data types which are undefined, null, boolean, string, symbol, number, and object.

 

When JavaScript variables are declared, they have an initial value of undefined. If you do a mathematical operation on an undefined variable your result will be NaN which means "Not a Number". If you concatenate a string with an undefined variable, you will get a literal string of "undefined".

 

 camelCase =  first word in lowercase and the first letter of each subsequent word is capitalized.

 

 Mad Libs style ex. var ourStr = "Hello, our name is " + ourName + ", how are you?";

 

Zero-based indexing = programming languages start counting from number 0 not 1;

 

Javascript array array methods

push(), pop(), shift()(removes the first element), unshift()(adds to the beginning of an array) 

 

 

Difference between parameters and arguments : 

In JavaScript, scope refers to the visibility of variables. Variables which are defined outside of a function block have Global scope.

Variables which are used without the var keyword are automatically created in the global scope.

 

== does type conversion, === is strict equality which does not automatically performs type conversion.

 

 

you access the data in objects through what are called properties.

if your object has any non-string properties, JavaScript will automatically typecast them as strings.

 

an example of javascript object notation aka json:

The Call Stack

Recursive functions use something called “the call stack.” When a program calls a function, that function goes on top of the call stack. This similar to a stack of books. You add things one at a time. Then, when you are ready to take something off, you always take off the top item.

 

Math random number range: 

Math.floor(Math.random() * (max - min + 1)) + min

 

Last picture explaination:

arrayRange's data type is set at line 3.

Since recursion always happens as call stack, if wanted print value is from 1 ~ 5, have to think of top book, which is the number 5. 5 gets unshift, then 4 all the way up to 1 which results 1 ~ 5 as answer. 

'ETC' 카테고리의 다른 글

es6  (0) 2020.02.10
JSON APIs and Ajax  (0) 2020.02.10
jsp에서 컨트롤러갈때 한글 깨짐현상(02/07/20 cudo notes 5)  (0) 2020.02.07
mysql password change(02/06/20 cudo notes 4)  (0) 2020.02.06
Applied Accesbility  (0) 2020.02.05

+ Recent posts