Skip to content

mixelpixel/eloquentJavaScript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

119 Commits
 
 
 
 
 
 
 
 

Repository files navigation

eloquentJavaScript

  • Exercises and notes from the book http://eloquentjavascript.net/
  • Started as preparation for Lambda University, July 3, 2017
    • Chapters 3 and 4 assigned as pre-Course homework

Chapter 3 - Functions

"People think that computer science is the art of geniuses but the actual reality is the opposite, just many people doing things that build on each other, like a wall of mini stones." -Donald Knuth

  1. Defining a Function

    "Some functions produce a value, such as power and square, and some don’t, such as makeNoise, which produces only a side effect. A return statement determines the value the function returns. When control comes across such a statement, it immediately jumps out of the current function and gives the returned value to the code that called the function. The return keyword without an expression after it will cause the function to return undefined."

    • 03.01a.js - Squaring a number
    • 03.01b.js - Make some noise!
    • 03.01c.js - Raise a base by an exponent
      • How to get multiple inputs from user?
  2. Parameters and Scopes

    "The parameters to a function behave like regular variables, but their initial values are given by the caller of the function, not the code in the function itself ... An important property of functions is that the variables created inside of them, including their parameters, are local to the function ... "

  3. Nested Scope

  4. Functions as Values

  5. Declaration Notation

  6. The Call Stack

  7. Optional Arguments

  8. Closure

  9. Recursion

  10. Growing Functions

    "How difficult it is to find a good name for a function is a good indication of how clear a concept it is that you’re trying to wrap."

  11. Functions and Side Effects

    Functions that create values are easier to combine in new ways than functions that directly perform side effects.

  12. Summary

    The function keyword, when used as an expression, can create a function value. When used as a statement, it can be used to declare a variable and give it a function as its value.

  13. Exercises

    • Minimum
    • Recursion
    • Bean Couting
      • Why doesn't this work with the .forEach loop? Maybe I need to split it into a proper array? Ah... yes, apparently forEach is only available with arrays? Also, "for" loops are apparently consideraly faster.

Chapter 4 - Data Structures: Objects and Arrays

"On two occasions I have been asked, ‘Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?’ [...] I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question." -Charles Babbage, Passages from the Life of a Philosopher (1864)

  1. The Weresquirrel

  2. Data Sets

  3. Properties

    When using a dot, the part after the dot must be a valid variable name, and it directly names the property. When using square brackets, the expression between the brackets is evaluated to get the property name. Whereas value.x fetches the property of value named “x”, value[x] tries to evaluate the expression x and uses the result as the property name.

  4. Methods

  5. Objects

  6. Mutability

When we have two numbers, 120 and 120, we can consider them precisely the same number, whether or not they refer to the same physical bits. But with objects, there is a difference between having two references to the same object and having two different objects that contain the same properties.

- [04.06.js](ch04-data-structures_objects-arrays/04.06.js)
  1. The Lycanthrope's Log

  2. Computing Correlation

  3. Objects as Maps

  4. The Final Analysis

  5. Further Arrayology

  6. Strings and their Properties

  7. The Arguments Object

  8. The Math Object

    Many languages will stop you, or at least warn you, when you are defining a variable with a name that is already taken. JavaScript does neither, so be careful.

  9. The Global Object

  10. Summary

    Objects can also serve as maps, associating values with names. The in operator can be used to find out whether an object contains a property with a given name. The same keyword can also be used in a for loop (for (var name in object)) to loop over an object’s properties.

  11. Exercises

Chapter 5 - Higher Order Functions

"Tzu-li and Tzu-ssu were boasting about the size of their latest programs. ‘Two-hundred thousand lines,’ said Tzu-li, ‘not counting comments!’ Tzu-ssu responded, ‘Pssh, mine is almost a million lines already.’ Master Yuan-Ma said, ‘My best program has five hundred lines.’ Hearing this, Tzu-li and Tzu-ssu were enlightened." -Master Yuan-Ma, The Book of Programming

"There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies." -C.A.R. Hoare, 1980 ACM Turing Award Lecture

Chapter 20 - Node.js

  1. Background
  2. Asynchronicity

Additional reading

Memory management

About

exercises and notes from the book http://eloquentjavascript.net/

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors