Created
August 5, 2021 09:59
-
-
Save Chojiu15/5b59ad8533e2443008ffc4311722041a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// const myFunction = (a, b) => { | |
// if(a > b){ | |
// return a | |
// } | |
// else if(b > a){ | |
// return b | |
// } | |
// else{ | |
// a + 'and' + b + 'are equals' | |
// `${a} and ${b} are equals ` | |
// } | |
// } | |
// console.log(myFunction(5,6)) | |
// function myName(name) { | |
// const myFullName = `Hello my name is ${name}` | |
// return myFullName | |
// } | |
// // console.log(myFunction(4,5)) | |
// console.log(myName('John')) | |
// EcmaScript5 | |
function myFunction (name) { | |
// ES5 | |
const oldWay = 'My return value' + ' ' + 'and' + ' ' + name | |
// ES6 | |
const newWay = `My name is : ${name}` | |
if(name === 'John'){ | |
return `My name is ${name}` | |
} | |
else{ | |
return `I don't know who you are` | |
} | |
} | |
//ES6 | |
const myFunction = (name) => { | |
if(name === 'John'){ | |
return `My name is ${name}` | |
} | |
else{ | |
return `I don't know who you are` | |
} | |
} | |
console.log(myFunction('Jane')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment