Skip to content

Instantly share code, notes, and snippets.

@winsandymyint
Created May 25, 2016 16:51
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 winsandymyint/74e4eb1f8949282ad910988406b5d5c9 to your computer and use it in GitHub Desktop.
Save winsandymyint/74e4eb1f8949282ad910988406b5d5c9 to your computer and use it in GitHub Desktop.
A love letter function written by ECMA 6 arrows
let message= function(heartSay){
[73 , 32, 108, 111, 118, 101, 32, 121, 111, 117].forEach(function(value){
heartSay+=String.fromCharCode(value)
});
return heartSay;
}
message('')
//"I love you"
/* Another Ways of calling the above function by using ECMAScript 6 arrows */
let message= heartSay =>{
[73 , 32, 108, 111, 118, 101, 32, 121, 111, 117].forEach((value)=> heartSay+=String.fromCharCode(value));
return heartSay;
}
message('')
//"I love you"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment