JSFiddle - React, Tailwind, and code Playground
by Sudheer Nunna
JavaScript
// Installed npm packages: jquery underscore request express
// jade shelljs passport http sys lodash async mocha chai sinon
// sinon-chai moment connect validator restify ejs ws co when
// helmet wrench brain mustache should backbone forever debug jsdom
var y = 1;
if (function f(){}) {
y += typeof f;
}
console.log(y);
---------------$
var output = (function(x){
delete x;
return x;
})(0);
console.log(output);
------------------
var arrayList = ['a','b','c','d','e','f'];
arrayList=[];
arrayList.length=0;
arrayList.splice(0,arrayList.length)
--------------------$
var x = 1;
var output = (function(){
delete x;
return x;
})();
console.log(output);
----------------$
var trees = ["redwood","bay","cedar","oak","maple"];
delete trees[3];
trees.splice(0,1);
--------------
var bar = true;
console.log(bar + 0);
console.log(bar + "xyz");
console.log(bar + true);
console.log(bar + false);
------------$
var z = 1, y = z = typeof y;
console.log(y);
-------------$
bar();
var foo = function(){
// Some code
};
foo();
function bar(){
// Some code
};
------------------
var dog = new Animal();
dog instanceof Animal
-----------------
var list = readHugeList();
var nextListItem = function() {
var item = list.pop();
if (item) {
// process the list item...
setTimeout(nextListItem(),1);
}
};
--------------------
var arr1 = "john".split('');
['j','o','h','n']
var arr2 = arr1.reverse();
['n','h','o','j']
var arr3 = "jones".split('');
['j','o','h','n','s']
arr2.push(arr3);
console.log("array 1: length=" + arr1.length + " last=" + arr1.slice(-1));
console.log("array 2: length=" + arr2.length + " last=" + arr2.slice(-1));