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 simpleObject = { myVariable: 'some value' }; | |
// Using dot notation to access property value | |
console.log(simpleObject.myVariable); | |
// Using bracket notation to access property value | |
console.log(simpleObject['myVariable']); |
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 numbersArray = [10, 20, 30, 40]; | |
const stringArray = ['red', 'green', 'blue']; | |
const booleanArray = [true, true, false]; | |
const mixedArray = [true, 'red', 10]; |
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 variable1 = 10; | |
const variable2 = variable1; | |
const variable3 = "Zach"; | |
const variable4 = { | |
variableType: "object", | |
variableValue: "some value", | |
}; | |
const variable5 = (function () { | |
return "Hello, my name is "; | |
})(); |
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 yourFirstVariable = "learning to code gives you superpowers"; | |
const yourSecondVariable = 10; | |
const yourThirdVariable = { name: "third variable", value: 40 }; |
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
// This is a comment | |
/* | |
This is also a comment, and extends | |
to multiple lines | |
*/ | |
console.log("the console.log statement prints values to the console"); |
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
// Oh hey, this is a comment because the line starts with two forward slashes. It doesn't affect the code | |
let counterVariable = 1; | |
// Increases the variable by 1 | |
counterVariable = counterVariable + 1; | |
// ALSO increases the variable by 1 (this is the shorthand version) | |
counterVariable++; |
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
function computeMortgagePayment( | |
interestRate: number, | |
price: number, | |
term: number | |
): number { | |
// No need for us to know the implementation details because we have an API! | |
} |
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
async function analyzeText(url) { | |
// Imports the Google Cloud client library | |
const vision = require("@google-cloud/vision"); | |
// Creates a client | |
const client = new vision.ImageAnnotatorClient(); | |
const request = { | |
image: { | |
source: { imageUri: url }, | |
}, |
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
# log command for reference: git log --oneline --decorate --graph --all | |
git init | |
touch file-1.txt | |
git add . | |
git commit -m "first commit" | |
git checkout -b develop | |
touch file-created-by-develop-branch.txt | |
git add . | |
git commit -m "add develop branch file" |
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 dateValue = dateInput.value; // Notice that we are grabbing the raw value, not the date value | |
const userSpecifiedTimezone = "EDT"; // Assume, this was selected by the user | |
// The date value is now a string, so grab the pieces | |
const dateParts = dateValue.split("-"); | |
const year = dateParts[0]; | |
const month = dateParts[1]; | |
const day = dateParts[2]; | |
// Construct a new JS date using the individual pieces and timezone specification |