Code

General Code

JSON

JavaScript Object Notation, or JSON, gives us the ability to send JavaScript over a network/internet. To do this, we need to use the global JSON object to turn it into a string to send it over the wire… This will output {“name”:”Bongo”,”type”:”gorilla”}. So we can send this to any API endpoint on the web. Notice […]

JSON Read More »

Prototypes

Prototypes are a way to make our code more efficient, especially when using constructors. Take the following code for example… Imagine we have one thousand animals. When we use the “new” keyword, the data basically gets copied to the new object. So we would create one thousand grunt functions. Maybe we do not need one

Prototypes Read More »

Default Parameters

When writing functions, we might have times when we have argument sent and other times when no arguments are sent to the function. In the cases where no arguments are sent, we might want to have default parameter values. In this case, “Bongo” prints out because we did not send any arguments. If we change

Default Parameters Read More »