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 original = ["dog", "bee", "bee", ["John", "bob", "Doe", ["frank", "bob"]]].flat(Infinity) | |
original.forEach((item, index, array) => { | |
console.log("ITEM:", item, index, array) | |
}) | |
const toUpperCaseMapper = original.map((item, index) => { | |
console.log("ITEM:", item, index) | |
return item.toUpperCase() | |
}) | |
console.log(toUpperCaseMapper) |
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
import { useState } from "react" | |
import Iconify from "minimals-template/components/Iconify" | |
import { BlockClicks } from "lib/@components/block-clicks" | |
import { IconButton } from "@mui/material" | |
import { errorSnackbar } from "lib/snackbar/error-snackbar" | |
import { successSnackbar } from "lib/snackbar/success-snackbar" | |
export const TODO_STATE = { | |
TODO: "TODO", | |
DOING: "DOING", |
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
var scores = [95, 85, 76, 65, 84, 91] | |
var total = 0 | |
for(var i = 0; i < scores.length; i++) { | |
total += scores[i] | |
} | |
var average = total / scores.length | |
function displayAverage() { | |
document.getElementById('average').innerText = "Average Score: " + average |
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
// Example 1: | |
const name = "Dave"; | |
const greeting = `Hello, ${name}!`; | |
console.log(greeting); // What is logged? | |
// Example 2: | |
function example(name = "Guest") { | |
console.log(`Hello, ${name}!`); | |
} | |
example("Andy"); // What is logged? |
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
// Example 1: | |
console.log(x); | |
var x = 5; | |
// What is logged? | |
// Example 2: | |
const name = "John"; | |
const greeting = `Hello, ${name}!`; | |
console.log(greeting); | |
// What is logged? |
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
import { useState, useEffect } from "react"; | |
function useWindowSize() { | |
const [windowSize, setWindowSize] = useState({ | |
width: window.innerWidth, | |
height: window.innerHeight | |
}); | |
useEffect(() => { | |
function handleResize() { |
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
var MyString = "" | |
function gen(x, y) { | |
MyString = MyString + "<div>The test is returning: " | |
if (x == y) { | |
MyString = MyString + "true </div>" | |
} else MyString = MyString + "false </div>" | |
} | |
function myGenComponent() { |
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
var MyString = "" | |
function gen(x, y) { | |
MyString = MyString + "<div>The test is returning: " | |
if (x == y) { | |
MyString = MyString + "true </div>" | |
} else MyString = MyString + "false </div>" | |
} | |
function myGenComponent() { |
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
// Example 1 | |
const myArray = ["John", "Doe"]; | |
const array = [a, b, ...myArray]; | |
// Example 2 | |
const [a, b] = ["Andy", "James"]; | |
console.log(b); | |
// Example 3 | |
const value = (sfg20?.schedules?.plans ?? []); |
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
// Can you spot a potential issue here? If so, what steps might you take to mitigate it? | |
function MyComponent() { | |
React.useEffect(() => { | |
function handleResize () { | |
console.log("Resize handler triggered!") | |
} | |
window.addEventListener("resize", handleResize) | |
}) | |
// ...rest of Component |
NewerOlder