Skip to content

Instantly share code, notes, and snippets.

View sunilhari's full-sized avatar
✈️
Fight or Flight

Sunil Hari sunilhari

✈️
Fight or Flight
View GitHub Profile
"Before Set-Time-Out"
"Outside Set-Time-Out"
"Inside Set-Time-Out" -->Would be printed after 1000 milliseconds
"Exiting Set-Time-Out after 1000 milliseconds" -->Would be printed after 1000 milliseconds
const flatten = arr => {
let i = 0;
while (i < arr.length) {
if (Array.isArray(arr[i])) {
arr.splice(i, 1, ...arr[i]);
} else {
i++;
}
}
return arr;
const TIME_OUT = 1000;
function start(){
console.log("Before Set-Time-Out");
setTimeout(function(){
console.log("Inside Set-Time-Out","Exiting Set-Time-Out after "+TIME_OUT+" milliseconds");
},TIME_OUT);
console.log("Outside Set-Time-Out");
}
start();
@sunilhari
sunilhari / index.html
Created September 8, 2017 18:17 — forked from dreyescat/index.html
Webpack config to expose bundle in a variable in the global context
<html>
<head>
</head>
<body>
<script src="lib/yourlib.js"></script>
<script>
window.onload = function () {
EntryPoint.run();
};
</script>
//1.
var x;
x++;
console.log(x);
//Output:NaN
//2.
//Check whether a number is NaN with out using isNaN