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 obj = { | |
dev: 'bfe', | |
a: function() { | |
return this.dev | |
}, | |
b() { | |
return this.dev | |
}, | |
c: () => { | |
return this.dev |
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
// Type JavaScript here and click "Run Code" or press Ctrl + s | |
console.log('Hello, world!'); | |
// CHALLENGE 1 | |
function sumFunc(arr) { | |
// YOUR CODE HERE | |
let accumulator = 0; | |
for (let i = 0; i < arr.length; i++) { | |
accumulator += arr[i]; |
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
https://stackoverflow.com/questions/37601282/javascript-array-splice-vs-slice/54114834#54114834 |
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
useEffect(() => { | |
/** | |
* trapping next router before-pop-state to manipulate router change | |
* on browser back button quick filter modal should be closed | |
*/ | |
router.beforePopState(() => { | |
if (isOpen) { | |
/** | |
* only applicable if modal is open. | |
*/ |
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
// debounce | |
function debounce(func, wait, immediate) { | |
var timeout; | |
return function() { | |
var context = this, args = arguments; | |
var later = function() { | |
timeout = null; | |
if (!immediate) func.apply(context, args); | |
}; |
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
// EXAMINE THE DOCUMENT OBJECT // | |
// console.dir(document); | |
// console.log(document.domain); | |
// console.log(document.URL); | |
// console.log(document.title); | |
// //document.title = 123; | |
// console.log(document.doctype); | |
// console.log(document.head); | |
// console.log(document.body); |
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
function waitForever() { | |
return new Promise(r => {}); | |
} | |
// Usage: | |
await waitForever(); |
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 express = require('express') | |
const next = require('next') | |
const cookieParser = require('cookie-parser') | |
const dev = process.env.NODE_ENV !== 'production' | |
const app = next({ dev }) | |
const handle = app.getRequestHandler() | |
const url = require('url') | |
const path = require('path') | |
const expressApp = express() |
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
class SomeComponent extends React.PureComponent { | |
// Each instance of SomeComponent has a cache of click handlers | |
// that are unique to it. | |
clickHandlers = {}; | |
// Generate and/or return a click handler, | |
// given a unique identifier. | |
getClickHandler(key) { |
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
div { | |
opacity: 0; | |
animation: fadeIn 1s 0.5s forwards | |
} | |
@keyframes fadeIn { | |
100% { | |
opcaity: 1 | |
} | |
} |
NewerOlder