Skip to content

Instantly share code, notes, and snippets.

@LuisMDeveloper
Forked from anonymous/index.html
Created August 3, 2016 03:42
Show Gist options
  • Select an option

  • Save LuisMDeveloper/d4e24bb39dfce8b4803cd4db1102e851 to your computer and use it in GitHub Desktop.

Select an option

Save LuisMDeveloper/d4e24bb39dfce8b4803cd4db1102e851 to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/giyaqa
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
'use strict';
var createGreeting = function createGreeting(message, name) {
return message + name;
};
//console.log(createGreeting('Hello ', 'Luis'));
var arrowGreeting = function arrowGreeting(message, name) {
return message + name;
};
var arrowGreeting = function arrowGreeting(message, name) {
return message + name;
};
var arrowGreeting = function arrowGreeting(message) {
return message + 'Luis';
};
console.log(arrowGreeting('Hello '));
var deliveryBoy = {
name: "John",
handleMessage: function handleMessage(message, handler) {
handler(message);
},
receive: function receive() {
var that = this;
this.handleMessage("Hello ", function (message) {
that.name; // get the proper name
console.log(message + that.name);
});
}
};
deliveryBoy.receive();
var deliveryBoyArrow = {
name: "John 2",
handleMessage: function handleMessage(message, handler) {
handler(message);
},
receive: function receive() {
var _this = this;
this.handleMessage("Hello ", function (message) {
return console.log(message + _this.name);
});
}
};
deliveryBoyArrow.receive();
</script>
<script id="jsbin-source-javascript" type="text/javascript">var createGreeting = function(message, name) {
return message + name;
}
//console.log(createGreeting('Hello ', 'Luis'));
var arrowGreeting = (message, name) => {
return message + name;
}
var arrowGreeting = (message, name) => message + name;
var arrowGreeting = message => message + 'Luis';
console.log(arrowGreeting('Hello '));
var deliveryBoy = {
name: "John",
handleMessage: function (message, handler) {
handler(message);
},
receive: function() {
var that = this;
this.handleMessage("Hello ", function(message) {
that.name; // get the proper name
console.log(message + that.name);
})
}
}
deliveryBoy.receive();
var deliveryBoyArrow = {
name: "John 2",
handleMessage: function (message, handler) {
handler(message);
},
receive: function() {
this.handleMessage("Hello ", message => console.log(message + this.name))
}
}
deliveryBoyArrow.receive();</script></body>
</html>
'use strict';
var createGreeting = function createGreeting(message, name) {
return message + name;
};
//console.log(createGreeting('Hello ', 'Luis'));
var arrowGreeting = function arrowGreeting(message, name) {
return message + name;
};
var arrowGreeting = function arrowGreeting(message, name) {
return message + name;
};
var arrowGreeting = function arrowGreeting(message) {
return message + 'Luis';
};
console.log(arrowGreeting('Hello '));
var deliveryBoy = {
name: "John",
handleMessage: function handleMessage(message, handler) {
handler(message);
},
receive: function receive() {
var that = this;
this.handleMessage("Hello ", function (message) {
that.name; // get the proper name
console.log(message + that.name);
});
}
};
deliveryBoy.receive();
var deliveryBoyArrow = {
name: "John 2",
handleMessage: function handleMessage(message, handler) {
handler(message);
},
receive: function receive() {
var _this = this;
this.handleMessage("Hello ", function (message) {
return console.log(message + _this.name);
});
}
};
deliveryBoyArrow.receive();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment