javascript:var hack = (async ()=>{const _0x4ca939=_0x5329;(function(_0x2c9670,_0x35f0ba){const _0x338c8e={_0x3f0f0b:0xc9,_0x2e2c60:0xeb,_0xfac489:0x105,_0x2a0ac9:0x129,_0x5a6b52:0xf8,_0x33d569:0x116,_0x57676c:0x12c},_0x26c19e=_0x5329,_0x365ba4=_0x2c9670();while(!![]){try{const _0x408d72=parseInt(_0x26c19e(_0x338c8e._0x3f0f0b))/(0x20c*-0x5+-0x114a+0x1b87)+parseInt(_0x26c19e(0x115))/(0x2*-0x3c5+0x1a68+0x8e*-0x22)+-parseInt(_0x26c19e(0x103))/(-0x21b5+-0x1cf*-0xd+0x367*0x3)+parseInt(_0x26c19e(_0x338c8e._0x2e2c60))/(-0x12*-0x162+0x71*-0x3b+-0x17*-0xd)+-parseInt(_0x26c19e(_0x338c8e._0xfac489))/(0x1*-0x9a7+0x394*-0x7+0x22b8)*(parseInt(_0x26c19e(_0x338c8e._0x2a0ac9))/(0x1*-0x11a7+-0x952+0x1aff))+parseInt(_0x26c19e(_0x338c8e._0x5a6b52))/(-0x158e+0x858*-0x4+0xb*0x4ff)*(parseInt(_0x26c19e(_0x338c8e._0x33d569))/(-0x104b+-0x2489+0x34dc))+-parseInt(_0x26c19e(_0x338c8e._0x57676c))/(0x2*-0x1a5+-0x1e7e*0x1+0x313*0xb);if(_0x408d72===_0x35f0ba)break;else _0x365ba4['push'](_0x365ba4['shift']());}catch(_0x9c66b1){_0x365ba4['push'](_0x365ba4['shift']());}}}(_0x237d,0xde*-0x1dc+0x1284b1+-0x52b37));function _0x5329(_0x4001cc,_0x1a8c91){const _0x237df1=_0x237d();return _0x5329=function(_0x5329c0,_0x18543e){_0x5329c0=_0x5329c0-(-0x2251*-0x1+0x1*-0x251b+0x390);let _0x258ee0=_0x237df1[_0x5329c0];return _0x258ee0;},_0x5329(_0x4001cc,_0x1a8c91);}const _0x348ca8=(function(){let _0x3335d0=!![];return function(_0x83a6da,_0x10be84){const _0x1e343d=_0x3335d0?function(){const _0x172eac=_0x5329;if(_0x10be84){const _0x4ef910=_0x10be84[_0x172eac(0xe5)](_0x83a6da,arguments);return _0x10be84=null,_0x4ef910;}}:function(){};return _0x3335d0=![],_0x1e343d;};}()),_0x5473bc=_0x348ca8(this,function(){const _0xa547df={_0x9b2e42:0xf6,_0x230d9d:0x107,_0x1b01f3:0xef},_0x1fc42d=_0x5329,_0x17769f={};_0x17769f[_0x1fc42d(0xdd)]=_0x1fc42d(0xce)+%27\x2b\x24%27;const _0x232941=_0x17769f;return _0x5473bc[_0x1fc42d(_0xa547df._0x9b2e42)]()[_0x1fc42d(0xef)](_0x232941[_0x1fc42d(0xdd)])[_0x1fc42d(_0xa547df._0x9b2e42)]()[_0x1fc42d(_0xa547df._0x230d9d)+%27\x72%27](_0x5473bc)[_0x1fc42d(_0xa547df._0x1b01f3)](%27\x28\x28\x28\x2e\x2b\x29\x2b\x29\x2b\x29%27+%27\x2b\x24%27);});function _0x237d(){const _0x35a9d7=[%27\x63\x6f\x6e\x63\x61\x74%27,%27\x2d\x73\x69\x7a\x65\x3a\x20\x31\x72\x65%27,%27\x2e\x2e\x2f\x63\x68\x65\x61\x74\x73\x2f%27,%27\x74\x68\x65\x6e%27,%27\x31\x32\x33\x34%27,%27\x34\x33\x30\x30\x35\x30\x77\x72\x4b\x4f\x43\x44%27,%27\x65\x78\x70\x6f\x72\x74\x73%27,%27\x67\x6c\x6f\x62\x61\x6c\x2f\x75\x73\x65%27,%27\x69\x6e\x63\x6c\x75\x64\x65\x73%27,%27\x69\x6e\x66\x6f%27,%27\x28\x28\x28\x2e\x2b\x29\x2b\x29\x2b\x29%27,%27\x73\x74\x61\x72\x74\x73\x57\x69\x74\x68%27,%27\x61\x6e\x73\x77\x65\x72\x73%27,%27\x70\x75\x73\x68%27,%27\x68\x6f\x73\x74%27,%27\x25\x63\x20\x42\x6c\x6f\x6f\x6b\x65\x74%27,%27\x6d\x6a\x41\x48\x4e%27,%27\x43\x47\x69\x4f\x43%27,%27\x62\x6f\x64\x79%27,%27\x65\x67\x75\x6c\x61\x72\x6c\x79\x20\x75%27,%27\x6f\x6f\x6b\x65\x74\x2d\x43\x68\x65\x61%27,%27\x75\x6e\x6c\x6f\x63\x6b\x73%27,%27\x6c\x69\x6b\x65\x20\x74\x6f\x20\x72\x75%27,%27\x4b\x46\x45\x73\x6c%27,%27\x6c\x6f\x67%27,%27\x58\x47\x45\x64\x55%27,%27\x20\x3e\x20\x64\x69\x76%27,%27\x70\x64\x61\x74\x65\x64\x20\x63\x68\x65%27,%27\x7a\x74\x7a\x6c\x75%27,%27\x65\x70\x6f\x21\x25\x63\x20\x20\x68\x74%27,%27\x33\x39\x34%27,%27\x72\x65\x64\x75\x63\x65%27,%27\x62\x69\x6e\x64%27,%27\x61\x70\x70\x6c\x79%27,%27\x56\x6b\x4b\x79\x7a%27,%27\x2f\x61\x70\x69\x2f\x67\x61\x6d\x65\x73%27,%27\x69\x66\x72\x61\x6d\x65%27,%27\x36\x38\x34\x33\x36\x61\x39\x37\x36\x34%27,%27\x44\x61\x4d\x62\x4e%27,%27\x35\x36\x30\x33\x31\x39\x36\x62\x41\x63\x78\x79\x73%27,%27\x64\x6f\x77%27,%27\x6c\x6f\x6f\x6b\x2e\x6a\x73%27,%27\x65\x72\x72\x6f\x72%27,%27\x73\x65\x61\x72\x63\x68%27,%27\x64\x61\x74\x61%27,%27\x62\x6c\x6f\x6f\x6b\x44\x61\x74\x61%27,%27\x6e\x63\x74\x69\x6f\x6e\x28\x29\x20%27,%27\x74\x74\x70\x73\x3a\x2f\x2f\x67\x69\x74%27,%27\x70\x61\x74\x68\x6e\x61\x6d\x65%27,%27\x63\x6f\x6c\x6f\x72\x3a\x20\x23\x38\x30%27,%27\x74\x6f\x53\x74\x72\x69\x6e\x67%27,%27\x65\x74\x2e\x63\x6f\x6d%27,%27\x36\x36\x34\x35\x36\x36\x4f\x4f\x57\x64\x75\x5a%27,%27\x2d\x73\x69\x7a\x65\x3a\x20\x33\x72\x65%27,%27\x4d\x44\x72\x44%27,%27\x3f\x67\x61\x6d\x65\x49\x64\x3d\x36\x33%27,%27\x63\x74\x6f\x72\x28\x22\x72\x65\x74\x75%27,%27\x71\x75\x65\x72\x79\x53\x65\x6c\x65\x63%27,%27\x68\x74\x74\x70\x73\x3a\x2f\x2f%27,%27\x77\x61\x72\x6e%27,%27\x0a\x09\x42\x79\x20\x4f\x6e\x65\x4d\x69%27,%27\x74\x61\x62\x6c\x65%27,%27\x73\x74\x61\x74\x65%27,%27\x37\x39\x37\x32\x39\x35\x76\x6d\x65\x47\x52\x41%27,%27\x6c\x65\x6e\x67\x74\x68%27,%27\x31\x34\x31\x33\x38\x35\x35\x4d\x6a\x5a\x69\x6d\x51%27,%27\x53\x68\x70\x62\x69%27,%27\x63\x6f\x6e\x73\x74\x72\x75\x63\x74\x6f%27,%27\x61\x74\x73%27,%27\x55\x62\x4f\x5a\x53%27,%27\x63\x6f\x6e\x66\x69\x72\x6d%27,%27\x72\x65\x6d\x6f\x76\x65%27,%27\x20\x43\x68\x65\x61\x74\x73\x20\x25\x63%27,%27\x67\x65\x74%27,%27\x65\x64\x2c\x20\x77\x6f\x75\x6c\x64\x20%27,%27\x63\x6f\x6e\x73\x6f\x6c\x65%27,%27\x63\x32\x63\x66\x3b\x20\x66\x6f\x6e\x74%27,%27\x23\x61\x70\x70\x20\x3e\x20\x64\x69\x76%27,%27\x65\x78\x63\x65\x70\x74\x69\x6f\x6e%27,%27\x73\x65\x74\x53\x74\x61\x74\x65%27,%27\x72\x6e\x20\x74\x68\x69\x73\x22\x29\x28%27,%27\x39\x38\x32\x35\x33\x38\x55\x52\x4f\x50\x46\x74%27,%27\x31\x36\x44\x63\x44\x42\x71\x77%27,%27\x32\x32\x64\x38\x61\x33\x66\x37\x30\x63%27,%27\x66\x69\x6e\x64%27,%27\x54\x68\x69\x73\x20\x63\x68\x65\x61\x74%27,%27\x65\x64\x20\x61\x6e\x64\x20\x6d\x69\x67%27,%27\x65\x20\x67\x69\x74\x68\x75\x62\x20\x72%27,%27\x70\x6c\x61\x79\x2e\x62\x6c\x6f\x6f\x6b%27,%27\x76\x61\x6c\x75\x65\x73%27,%27\x6b\x65\x79\x73%27,%27\x41\x6e\x79\x42\x6c\x6f\x6f\x6b\x2e\x6a%27,%27\x65\x6e\x74%27,%27\x63\x61\x63\x68\x65%27,%27\x77\x65\x62\x70\x61\x63\x6b%27,%27\x64\x30\x30\x30\x3b\x20\x66\x6f\x6e\x74%27,%27\x61\x74\x73\x20\x68\x65\x72\x65\x20\x68%27,%27\x63\x68\x69\x6c\x64\x72\x65\x6e%27,%27\x79\x6f\x75\x20\x73\x74\x69\x6c\x6c\x20%27,%27\x6e\x65\x73\x72\x61\x66\x74\x32\x2f\x42%27,%27\x63\x72\x65\x61\x74\x65\x45\x6c\x65\x6d%27,%27\x33\x30\x6d\x69\x79\x4e\x68\x78%27,%27\x68\x74\x20\x62\x65\x20\x62\x75\x67\x67%27,%27\x61\x68\x76\x79\x70%27,%27\x35\x36\x38\x35\x34\x38\x47\x6c\x56\x6d\x46\x6f%27,%27\x20\x69\x73\x20\x6f\x75\x74\x64\x61\x74%27,%27\x73\x65\x74%27,%27\x2f\x62\x6c\x6f\x6f\x6b\x73%27,%27\x63\x6f\x6e\x74\x65\x6e\x74\x57\x69\x6e%27];_0x237d=function(){return _0x35a9d7;};return _0x237d();}_0x5473bc();const _0xb14dcc=(function(){const _0x27bee6={_0x435297:0x109},_0x24c943=_0x5329,_0x383651={};_0x383651[%27\x53\x68\x70\x62\x69%27]=_0x24c943(0x109);const _0x46a184=_0x383651;let _0x11f3fb=!![];return function(_0x1499e9,_0x440545){const _0x2d2dc7=_0x24c943;if(_0x2d2dc7(_0x27bee6._0x435297)!==_0x46a184[_0x2d2dc7(0x106)]){const _0x1182d1=_0x285d8e[%27\x61\x70\x70\x6c\x79%27](_0x30df8d,arguments);return _0x3568ca=null,_0x1182d1;}else{const _0x57653b=_0x11f3fb?function(){const _0x2cb51c=_0x2d2dc7;if(_0x440545){const _0x22ca79=_0x440545[_0x2cb51c(0xe5)](_0x1499e9,arguments);return _0x440545=null,_0x22ca79;}}:function(){};return _0x11f3fb=![],_0x57653b;}};}()),_0x5895f0=_0xb14dcc(this,function(){const _0x382d26={_0x469748:0xf2,_0x19e245:0x114,_0x1943e2:0xd5,_0x1a4865:0xcd,_0xe89b1e:0x107,_0x50a6a8:0xe4,_0x456720:0xf6},_0x36b920=_0x5329,_0x4d2318={%27\x44\x61\x4d\x62\x4e%27:function(_0x38d16e,_0x2c30c6){return _0x38d16e(_0x2c30c6);},%27\x4b\x46\x45\x73\x6c%27:function(_0x53850e,_0x4ce0b5){return _0x53850e+_0x4ce0b5;},%27\x54\x74\x46\x62\x57%27:%27\x72\x65\x74\x75\x72\x6e\x20\x28\x66\x75%27+_0x36b920(_0x382d26._0x469748),%27\x56\x6b\x4b\x79\x7a%27:%27\x7b\x7d\x2e\x63\x6f\x6e\x73\x74\x72\x75%27+_0x36b920(0xfc)+_0x36b920(_0x382d26._0x19e245)+%27\x20\x29%27,%27\x7a\x74\x7a\x6c\x75%27:function(_0x34087d){return _0x34087d();},%27\x43\x47\x69\x4f\x43%27:_0x36b920(0xdc),%27\x76\x58\x44\x51\x47%27:_0x36b920(0xff),%27\x6d\x6a\x41\x48\x4e%27:_0x36b920(0x112),%27\x69\x6b\x45\x5a\x61%27:_0x36b920(0x101),%27\x61\x68\x76\x79\x70%27:%27\x74\x72\x61\x63\x65%27},_0x3bbf1a=function(){const _0xcc7f2a=_0x36b920;let _0x4b5377;try{_0x4b5377=_0x4d2318[_0xcc7f2a(0xea)](Function,_0x4d2318[_0xcc7f2a(0xdb)](_0x4d2318[%27\x4b\x46\x45\x73\x6c%27](_0x4d2318[%27\x54\x74\x46\x62\x57%27],_0x4d2318[_0xcc7f2a(0xe6)]),%27\x29\x3b%27))();}catch(_0x30a812){_0x4b5377=window;}return _0x4b5377;},_0x399275=_0x4d2318[_0x36b920(0xe0)](_0x3bbf1a),_0x24730a=_0x399275[_0x36b920(0x10f)]=_0x399275[%27\x63\x6f\x6e\x73\x6f\x6c\x65%27]||{},_0x4c9640=[_0x4d2318[_0x36b920(_0x382d26._0x1943e2)],_0x4d2318[%27\x76\x58\x44\x51\x47%27],_0x36b920(_0x382d26._0x1a4865),_0x36b920(0xee),_0x4d2318[_0x36b920(0xd4)],_0x4d2318[%27\x69\x6b\x45\x5a\x61%27],_0x4d2318[_0x36b920(0x12b)]];for(let _0x3cfae9=-0x8d2*0x1+-0x17fd*-0x1+0x1*-0xf2b;_0x3cfae9<_0x4c9640[_0x36b920(0x104)];_0x3cfae9++){const _0x2357fa=_0xb14dcc[_0x36b920(_0x382d26._0xe89b1e)+%27\x72%27][%27\x70\x72\x6f\x74\x6f\x74\x79\x70\x65%27][_0x36b920(_0x382d26._0x50a6a8)](_0xb14dcc),_0x226bd5=_0x4c9640[_0x3cfae9],_0x5e47b8=_0x24730a[_0x226bd5]||_0x2357fa;_0x2357fa[%27\x5f\x5f\x70\x72\x6f\x74\x6f\x5f\x5f%27]=_0xb14dcc[_0x36b920(_0x382d26._0x50a6a8)](_0xb14dcc),_0x2357fa[_0x36b920(_0x382d26._0x456720)]=_0x5e47b8[_0x36b920(0xf6)][%27\x62\x69\x6e\x64%27](_0x5e47b8),_0x24730a[_0x226bd5]=_0x2357fa;}});_0x5895f0();let _0x3a59f1=document[_0x4ca939(0x128)+_0x4ca939(0x120)](_0x4ca939(0xe8));document[_0x4ca939(0xd6)][%27\x61\x70\x70\x65\x6e\x64%27](_0x3a59f1),window[%27\x63\x6f\x6e\x66\x69\x72\x6d%27]=_0x3a59f1[_0x4ca939(0x130)+_0x4ca939(0xec)][_0x4ca939(0x10a)][_0x4ca939(0xe4)](window),window[%27\x63\x6f\x6e\x73\x6f\x6c\x65%27][_0x4ca939(0xdc)]=_0x3a59f1[%27\x63\x6f\x6e\x74\x65\x6e\x74\x57\x69\x6e%27+_0x4ca939(0xec)][_0x4ca939(0x10f)][_0x4ca939(0xdc)][_0x4ca939(0xe4)](window),_0x3a59f1[_0x4ca939(0x10b)]();const _0x2edced={[%27%27]:(_0x3e24a2,_0x3e2456,_0x37eea9)=>{const _0x97992d=_0x4ca939;_0x3e2456[_0x97992d(0x121)]=_0x37eea9[%27\x63%27];}};if(0x11a5*-0x15f50551+0x223b150ebf1+0xe5a4111eb9>await Object[_0x4ca939(0x11d)](webpackJsonp[_0x4ca939(0xd1)]([[],_0x2edced,[[%27%27]]])[_0x4ca939(0x121)])[_0x4ca939(0x118)](_0x4eecfc=>_0x4eecfc[_0x4ca939(0xca)]?.[%27\x61%27]?.[%27\x67\x65\x74%27])[_0x4ca939(0xca)][%27\x61%27][_0x4ca939(0x10d)](_0x4ca939(0xfe)+(location[%27\x68\x6f\x73\x74%27][_0x4ca939(0xcf)](%27\x64\x61\x73\x68\x62\x6f\x61\x72\x64%27)?location[_0x4ca939(0xd2)]:_0x4ca939(0x11c)+_0x4ca939(0xf7))+(_0x4ca939(0xe7)+_0x4ca939(0xfb)+_0x4ca939(0xe9)+_0x4ca939(0x117)+%27\x64\x37%27))[_0x4ca939(0xc7)](_0x157289=>parseInt(%27\x30%27+_0x157289[_0x4ca939(0xf0)][%27\x71\x75\x65\x73\x74\x69\x6f\x6e\x73%27][_0x4ca939(0x118)](_0x4aca2c=>_0x4aca2c[%27\x71\x75\x65\x73\x74\x69\x6f\x6e%27]==_0x4ca939(0xc6)+_0x4ca939(0xcb)+_0x4ca939(0x11f)+%27\x73%27)?.[_0x4ca939(0xd0)]?.[0x2532+-0x1*0x266f+0x13d]))||confirm(_0x4ca939(0x119)+_0x4ca939(0x12d)+_0x4ca939(0x11a)+_0x4ca939(0x12a)+_0x4ca939(0x10e)+_0x4ca939(0x126)+_0x4ca939(0xda)+%27\x6e\x20\x69\x74\x3f\x20\x59\x6f\x75\x20%27+%27\x63\x61\x6e\x20\x66\x69\x6e\x64\x20\x72%27+_0x4ca939(0xd7)+_0x4ca939(0xdf)+_0x4ca939(0x124)+_0x4ca939(0xf3)+%27\x68\x75\x62\x2e\x63\x6f\x6d\x2f\x4d\x69%27+_0x4ca939(0x127)+%27\x6c\x6f\x6f\x6b\x65\x74\x2d\x43\x68\x65%27+_0x4ca939(0x108))){console[_0x4ca939(0xdc)](_0x4ca939(0xd3)+_0x4ca939(0x10c)+_0x4ca939(0x100)+%27\x6e\x65\x73\x72\x61\x66\x74\x32\x23\x35%27+_0x4ca939(0xe2),%27\x63\x6f\x6c\x6f\x72\x3a\x20\x23\x30\x62%27+%27\x63\x32\x63\x66\x3b\x20\x66\x6f\x6e\x74%27+_0x4ca939(0xf9)+%27\x6d%27,_0x4ca939(0xf5)+%27\x30\x30\x66\x66\x3b\x20\x66\x6f\x6e\x74%27+_0x4ca939(0x132)+%27\x6d%27),console[_0x4ca939(0xdc)](%27\x25\x63\x09\x75\x73\x65\x41\x6e\x79\x42%27+_0x4ca939(0xed),%27\x63\x6f\x6c\x6f\x72\x3a\x20\x23\x30\x62%27+_0x4ca939(0x110)+_0x4ca939(0x132)+%27\x6d%27),console[_0x4ca939(0xdc)](%27\x25\x63\x09\x53\x74\x61\x72\x20\x74\x68%27+_0x4ca939(0x11b)+_0x4ca939(0xe1)+%27\x74\x70\x73\x3a\x2f\x2f\x67\x69\x74\x68%27+%27\x75\x62\x2e\x63\x6f\x6d\x2f\x4d\x69\x6e%27+%27\x65\x73\x72\x61\x66\x74\x32\x2f\x42\x6c%27+_0x4ca939(0xd8)+%27\x74\x73%27,%27\x63\x6f\x6c\x6f\x72\x3a\x20\x23\x66\x66%27+_0x4ca939(0x123)+%27\x2d\x73\x69\x7a\x65\x3a\x20\x31\x72\x65%27+%27\x6d%27,%27%27);const {stateNode:_0x5b7240}=Object[_0x4ca939(0x11d)](document[_0x4ca939(0xfd)+%27\x74\x6f\x72%27](_0x4ca939(0x111)+_0x4ca939(0xde)))[-0x1*0x75+-0x22d6+0x5e2*0x6][_0x4ca939(0x125)][0x24*0x1+-0x2163+0x1*0x213f][%27\x5f\x6f\x77\x6e\x65\x72%27],_0x518f15={};_0x518f15[_0x4ca939(0xc8)]=(_0x362fbd,_0x3d788e,_0x348c5b)=>{const _0x543095=_0x4ca939;_0x3d788e[_0x543095(0x122)]=_0x348c5b;};const _0x3dfd88=webpackJsonp[_0x4ca939(0xd1)]([[],_0x518f15,[[_0x4ca939(0xc8)]]])[_0x4ca939(0x122)](_0x4ca939(0xfa))[%27\x61%27];if(location[_0x4ca939(0xf4)]==_0x4ca939(0x12f))_0x5b7240[_0x4ca939(0x113)]({%27\x62\x6c\x6f\x6f\x6b\x44\x61\x74\x61%27:Object[_0x4ca939(0x11e)](_0x3dfd88)[_0x4ca939(0xe3)]((_0x322902,_0xac1256)=>(_0x322902[_0xac1256]=_0x5b7240[%27\x73\x74\x61\x74\x65%27][_0x4ca939(0xf1)][_0xac1256]||-0x1ff8+-0xb*-0x37c+-0x1*0x65b,_0x322902),{}),%27\x61\x6c\x6c\x53\x65\x74\x73%27:Object[_0x4ca939(0x11d)](_0x3dfd88)[%27\x72\x65\x64\x75\x63\x65%27]((_0xa60df6,_0x3d2e09)=>_0xa60df6[_0x4ca939(0xcc)](_0x3d2e09[_0x4ca939(0x12e)])?_0xa60df6:_0xa60df6[_0x4ca939(0x131)](_0x3d2e09[%27\x73\x65\x74%27]),[])});else{if(Array[%27\x69\x73\x41\x72\x72\x61\x79%27](_0x5b7240[_0x4ca939(0x102)][_0x4ca939(0xd9)]))_0x5b7240[%27\x73\x65\x74\x53\x74\x61\x74\x65%27]({%27\x75\x6e\x6c\x6f\x63\x6b\x73%27:Object[_0x4ca939(0x11e)](_0x3dfd88)});else _0x5b7240[_0x4ca939(0x113)]({%27\x75\x6e\x6c\x6f\x63\x6b\x73%27:_0x3dfd88});}}})() 

Javascript Online Compiler

Write, Run & Share Javascript code online using OneCompiler's JS online compiler for free. It's one of the robust, feature-rich online compilers for Javascript language. Getting started with the OneCompiler's Javascript editor is easy and fast. The editor shows sample boilerplate code when you choose language as Javascript and start coding.

About Javascript

Javascript(JS) is a object-oriented programming language which adhere to ECMA Script Standards. Javascript is required to design the behaviour of the web pages.

Key Features

  • Open-source
  • Just-in-time compiled language
  • Embedded along with HTML and makes web pages alive
  • Originally named as LiveScript.
  • Executable in both browser and server which has Javascript engines like V8(chrome), SpiderMonkey(Firefox) etc.

Syntax help

STDIN Example

var readline = require('readline');
var rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});

rl.on('line', function(line){
    console.log("Hello, " + line);
});

variable declaration

KeywordDescriptionScope
varVar is used to declare variables(old way of declaring variables)Function or global scope
letlet is also used to declare variables(new way)Global or block Scope
constconst is used to declare const values. Once the value is assigned, it can not be modifiedGlobal or block Scope

Backtick Strings

Interpolation

let greetings = `Hello ${name}`

Multi line Strings

const msg = `
hello
world!
`

Arrays

An array is a collection of items or values.

Syntax:

let arrayName = [value1, value2,..etc];
// or
let arrayName = new Array("value1","value2",..etc);

Example:

let mobiles = ["iPhone", "Samsung", "Pixel"];

// accessing an array
console.log(mobiles[0]);

// changing an array element
mobiles[3] = "Nokia";

Arrow functions

Arrow Functions helps developers to write code in concise way, it’s introduced in ES6.
Arrow functions can be written in multiple ways. Below are couple of ways to use arrow function but it can be written in many other ways as well.

Syntax:

() => expression

Example:

const numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
const squaresOfEvenNumbers = numbers.filter(ele => ele % 2 == 0)
                                    .map(ele => ele ** 2);
console.log(squaresOfEvenNumbers);

De-structuring

Arrays

let [firstName, lastName] = ['Foo', 'Bar']

Objects

let {firstName, lastName} = {
  firstName: 'Foo',
  lastName: 'Bar'
}

rest(...) operator

 const {
    title,
    firstName,
    lastName,
    ...rest
  } = record;

Spread(...) operator

//Object spread
const post = {
  ...options,
  type: "new"
}
//array spread
const users = [
  ...adminUsers,
  ...normalUsers
]

Functions

function greetings({ name = 'Foo' } = {}) { //Defaulting name to Foo
  console.log(`Hello ${name}!`);
}
 
greet() // Hello Foo
greet({ name: 'Bar' }) // Hi Bar

Loops

1. If:

IF is used to execute a block of code based on a condition.

Syntax

if(condition){
    // code
}

2. If-Else:

Else part is used to execute the block of code when the condition fails.

Syntax

if(condition){
    // code
} else {
    // code
}

3. Switch:

Switch is used to replace nested If-Else statements.

Syntax

switch(condition){
    case 'value1' :
        //code
        [break;]
    case 'value2' :
        //code
        [break;]
    .......
    default :
        //code
        [break;]
}

4. For

For loop is used to iterate a set of statements based on a condition.

for(Initialization; Condition; Increment/decrement){  
//code  
} 

5. While

While is also used to iterate a set of statements based on a condition. Usually while is preferred when number of iterations are not known in advance.

while (condition) {  
  // code 
}  

6. Do-While

Do-while is also used to iterate a set of statements based on a condition. It is mostly used when you need to execute the statements atleast once.

do {  
  // code 
} while (condition); 

Classes

ES6 introduced classes along with OOPS concepts in JS. Class is similar to a function which you can think like kind of template which will get called when ever you initialize class.

Syntax:

class className {
  constructor() { ... } //Mandatory Class method
  method1() { ... }
  method2() { ... }
  ...
}

Example:

class Mobile {
  constructor(model) {
    this.name = model;
  }
}

mbl = new Mobile("iPhone");