Created
November 4, 2019 10:24
-
-
Save arthur-littm/71bf7f5c4fcfede378e3faceb54b0b24 to your computer and use it in GitHub Desktop.
This file contains 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
console.log("Hello everyone!"); | |
let count = 1; | |
console.log(count) | |
count = count + 1; | |
console.log(count); | |
const firstName = "Arthur"; | |
// console.log(firstName.length); | |
// console.log(firstName[1]); | |
// console.log(firstName.substring(2)); | |
// firstName = "Paul" // => Error | |
console.log(`My name is ${firstName}, counter is ${count}`); |
This file contains 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 fruits = ["Banana"]; | |
// CRUD | |
fruits.push("Apple"); | |
fruits[0]; | |
fruits[0] = "Peach"; | |
fruits.splice(0, 1) | |
// index how many | |
const beatles = ["paul", "john", "ringo", "george"] | |
beatles.forEach((beatle) => { | |
console.log(beatle.toUpperCase()); | |
}); | |
This file contains 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 capitalize = (word) => { | |
const firstLetter = word[0].toUpperCase(); | |
console.log(firstLetter, "This is my message") | |
const restOfTheWord = word.substring(1).toLowerCase(); | |
return firstLetter + restOfTheWord; | |
} | |
console.log(capitalize("aRtHuR")); |
This file contains 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
let age = 14 | |
if (age >= 18) { | |
console.log("You can vote"); | |
} else { | |
console.log("You can't vote"); | |
} | |
if (age === 14) { | |
console.log("You are 14"); | |
} else if (age === 15) { | |
console.log("You are 15"); | |
} else { | |
console.log("You're not 14 or 15"); | |
} |
This file contains 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
// OLD WAY | |
// function square(x) { | |
// return x * x; | |
// } | |
// NEW WAY (ES6) | |
const square = (x) => { | |
return x * x; | |
} | |
// const square = (x) => x * x; | |
console.log(square(4)); |
This file contains 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 student = { | |
firstName: "Boris", | |
lastName: "Paillard" | |
}; | |
console.log(typeof(student)); | |
console.log(student["firstName"]); | |
student.jobTitle = "CEO"; | |
student.firstName = "Arthur"; | |
console.log(student); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment