Add launch.json
into the .vscode
folder.
Now, enter the Debug view. Either add debugger
into one of the tests or add breakpoints, before you execute one of the scripts.
import { useLayoutEffect, useState } from 'react'; | |
/** | |
* Determine if the input DOM element is truncated by CSS (using ellipse for example) | |
* @param domElement | |
* @returns boolean | |
*/ | |
export function isTruncated(domElement: Element): boolean { | |
// https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollWidth | |
return domElement.scrollWidth > domElement.clientWidth; |
import { useLayoutEffect, useState } from 'react'; | |
/** | |
* Determine if the input DOM element is truncated by CSS (using ellipse for example) | |
* @param domElement | |
* @returns boolean | |
*/ | |
export function isTruncated(domElement: Element): boolean { | |
// https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollWidth | |
return domElement.scrollWidth > domElement.clientWidth; |
https://www.youtube.com/watch?v=YnWPeA6l5UE | |
https://developer.mozilla.org/en-US/docs/Web/CSS/:has |
var data = { | |
"name.test": "Peter", | |
"name.test1": "Steve", | |
"name.test2": "Steve", | |
} |
:root { | |
--header-height: 3rem; | |
/*========== Colors ==========*/ | |
/* Change favorite color to match images */ | |
--hue-color: ; | |
/* HSL color mode */ | |
--color: hsl(var(--hue-color), 64%, 22%); | |
const theIndex = { | |
dog: ()=>{console.log("dog")}, | |
cat: ()=>{console.log("cat")}, | |
rabbit: ()=>{console.log("rabbit")} | |
} | |
theIndex["rabbit"] ? theIndex["rabbit"]() : console.log("rabbnothing theret") |
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>App Redirection</title> | |
</head> | |
<body> | |
<!-- iframe used for attempting to load a custom protocol --> | |
<iframe style="display:none" height="0" width="0" id="loader"></iframe> |
import React from "react"; | |
type AccordionType = { | |
children: React.ReactNode[] | React.ReactNode; | |
}; | |
const Accordion = (props: AccordionType) => { | |
return <div className="accordion">{props.children}</div>; | |
}; | |
//Yay, namespacing! |
// Remove Duplicates from an array | |
const removeDuplicates = | |
arr => arr.filter((item, index) => index === arr.indexOf(item)); | |
const removeDuplicates1 = array => [...new Set(array)]; | |
const removeDuplicates2 = array => Array.from(new Set(array)); | |
// Flattens an array(doesn't flatten deeply). |