Skip to content

Instantly share code, notes, and snippets.

@manojpanta
Last active April 28, 2019 03:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save manojpanta/3f9c03efe80ab6708d6ae09bd836d818 to your computer and use it in GitHub Desktop.
Save manojpanta/3f9c03efe80ab6708d6ae09bd836d818 to your computer and use it in GitHub Desktop.
## Value, Types, and Operators
Having some experience with ruby data types, JS data types seem to behave in a similar way.
NaN was a new thing here.
I feel pretty confident about the things i learned about JS from this chapter but ternary operatores are still on fuzzy side.
## Program Structure
It is interesting that we have to mention it is a variable every time we declare a variable unlike in ruby
Statements are executed from top to bottom as it's a scripting language.
Feel pretty good about do,while and fo loop.
Switch was lil bit harder to follow through, may be because of the syntax. Need to practice more on that.
## Functions
Being able to assign a function to a variable, calling that variable as function was something new.
Feel pretty good about calling declaring functions in 3 diff ways. Lessons about scope and call stack was
really helpful to sharpen my knowledge about programming in general.
And we can call a function with extra arguements even if they are not defined with those extra arguements.
Concept of closure is something i need to dig more into. Would choose loop over recursion at least when im dealing with JS.
## Data Structure
Both String and Array are behaving in similar way as in Ruby. Just the syntaxs are different when calling methods.
Object, i would campare that with Ruby Hash, are similar but different. The keys have to be symbol and keys acts like
methods for a the object related to it.
When assigning a new name value pair to an object, the syntax of JS did not make sense to me.
for example:
let objectA = {a: 1, b: 2};
Object.assign(objectA, {b: 3, c: 4});
we are starting from type of objectA not objectA itself. Also, two objects having values with same properties are not
evaluated as equal was really confusing. Do they have id or something that differentiate from one another?
the statement: When you compare objects with JavaScript’s == operator, it compares by identity, I am confused about.
## The Secret Life of an Objects.
Got to know more about encapsulation and polymorphism. Concept of prototypes are still fuzzy.
When defining a class, contructor looked like initialize in Ruby.There is no particular way of defining private properties in JS
(-) at the start of property names, indicates that those properties are private.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment