The two methods to conver data.
JSON.stringify JSON.parse
var user = JSON.stringify({name: 'dave', age: 1977, occupation: 'developer'});
user;
Map returns the value of an array, as a new array.
In my quest to learn it, I went to mozialla and found the explaination unclear. I started playing around with it to learn it.
var pets = ['cat', 'dog', 'mouse', 'bird']
var more_pets = pets.map(function(value){
return value;
})
function reduce(array, start, callback) {
// javascript, and all of programming often needs variables to contain state.
var current = start,
freq = array.length;
for (var i = 0; i < freq; i++){
// how much of learning is problem solving vs. syntax?
current = callback(current, array[i]);
Notes from Eloquent JavaScript
defineProperty()
Why use Object.create verse just normal {}?
Notes from Eloquent JavaScript
Recall that the apply and bind methods both take a first argument that can be used to simulate method calls. This first argument is in fact used to give a value to this.
There is a method similar to apply, called call. It also calls the function it is a method of but takes its arguments normally, rather than as an array. Like apply and bind, call can be passed a specific this value.
speak.apply(fatRabbit, ["Burp!"]);
// → The fat rabbit says 'Burp!'
speak.call({type: "old"}, "Oh my.");
<script>document.write('<script src="http://' + (location.host || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=1"></' + 'script>')</script> |
# make a command and come back to same directory | |
(cd foo/; git pull origin master; rm -rf .bundle; bundle) | |
# iterate over items and do something with them. | |
for i in payments accounts deals promotions | |
do | |
cd ~/Code/$i | |
rm -rf .bundle |
.superbox-inner { | |
outline: 1px solid #404041; | |
border: none; | |
float: left; | |
display: block; | |
padding: 93px 97px; | |
background: rgba(255, 255, 255,0.9); | |
position: fixed; | |
top: 10px; | |
left: 0px; |
# Exercise 1 : Your output should look like this: "Your total with tax is $4455.54." | |
shopping_cart = [ | |
{:name => "iPad 2", :price => 499, :quantity => 2}, | |
{:name => "iMac 27", :price => 1699, :quantity => 1}, | |
{:name => "MacBook Air 13", :price => 1299, :quantity => 1} | |
] | |