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
// eslint-disable-next-line @typescript-eslint/no-var-requires | |
const lodashClonedeep = require("lodash.clonedeep") | |
const array = [1337, { x: "✅" }, { y: { z: "⚡" } }] // deeply nested array | |
const copy = lodashClonedeep(array) // shallow copy with lodashClonedeep | |
console.info(array) // [1337, { x: "✅" }, { y: { z: "⚡" } }] | |
copy[0] = "leet" // change a primitive value (not nested) | |
copy[1].x = "❎" // change a deeply nested value | |
copy[2].y.z = "❌" // change another deeply nested value | |
console.info(array) // [1337, { x: "✅" }, { y: { z: "⚡" } }] | |
console.info(copy) // ["leet", { x: "❎" }, { y: { z: "❌" } }] |
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
"workbench.activityBar.visible": false, | |
"github.copilot.enable": { | |
"*": true, | |
"yaml": false, | |
"plaintext": false, | |
"markdown": false, | |
"env": false | |
}, |
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 myObj = { Hello: "🌎", Goodnight: "🌛", Hola: "🌮" } | |
const unsortedMap = new Map(Object.entries(myObj)) | |
console.log(unsortedMap) | |
// Map(3) {"Hello" => "🌎", "Goodnight" => "🌛", "Hola" => "🌮"} | |
// Step 1: Turn the Map into an array | |
const unsortedArray = [...unsortedMap] // same as Array.from | |
// Step 2: Sort the array with a callback function | |
const sortedArray = unsortedArray.sort(([key1, value1], [key2, value2]) => |
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
[1,5,10].sort() // [1, 10, 5] |
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 anArray = [5,3,3,3,4,2,1] | |
const aSet = new Set(anArray) | |
console.log(aSet) // Set(5) {5,3,4,2,1} | |
const uniqueArray = Array.from(aSet) | |
console.log(uniqueArray) // [5,3,4,2,1] | |
uniqueArray.sort((a,b)=>a-b) | |
// .sort((a,b)=>a-b)) to sort numbers | |
// just .sort() sorts alphabetically |
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 myObj = { Hello: "🌎", Goodnight: "🌛" } | |
const myMap = new Map(Object.entries(myObj)) | |
// Add an item | |
myObj["Hola"] = "🌮" | |
myMap.set("Hola", "🌮") | |
// Get an item | |
console.log(myObj["Hola"]) // 🌮 | |
console.log(myMap.get("Hola")) // 🌮 |
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 myObj = { Hello: "🌎", Goodnight: "🌛", Hola: "🌮" } | |
const unsortedMap = new Map(Object.entries(myObj)) | |
console.log(unsortedMap) | |
// Map(3) {"Hello" => "🌎", "Goodnight" => "🌛", "Hola" => "🌮"} | |
// Step 1: Turn the Map into an array | |
const unsortedArray = [...unsortedMap] // same as Array.from | |
// Step 2: Sort the array with a callback function | |
const sortedArray = unsortedArray.sort(([key1, value1], [key2, value2]) => |
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
<meta name="viewport" | |
content="width=device-width, initial-scale=1.0"> |
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
<section class="w-full flex flex-col items-center content-center border-4 border-purple-500 border-solid bg-blue-500"> | |
<div class="text-4xl font-bold bg-gray-100 fixed right-4 bottom-4">Tailwind CSS: w-full</div> |
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
"importSorter.importStringConfiguration.hasSemicolon": false, |