(function(_0x3fc37c,_0x27f0c4){function _0x1dcbd3(_0x1e0e71,_0x351c41){return _0x2aca(_0x1e0e71- -0xc4,_0x351c41);}var _0x2aecb8=_0x3fc37c();while(!![]){try{var _0x128d7e=parseInt(_0x1dcbd3(0x29,0x23))/0x1*(-parseInt(_0x1dcbd3(0x33,0x3c))/0x2)+parseInt(_0x1dcbd3(0x2c,0x27))/0x3*(parseInt(_0x1dcbd3(0x28,0x2c))/0x4)+parseInt(_0x1dcbd3(0x2f,0x27))/0x5+parseInt(_0x1dcbd3(0x22,0x1b))/0x6*(-parseInt(_0x1dcbd3(0x27,0x2a))/0x7)+parseInt(_0x1dcbd3(0x2e,0x37))/0x8*(-parseInt(_0x1dcbd3(0x2b,0x25))/0x9)+-parseInt(_0x1dcbd3(0x30,0x35))/0xa+parseInt(_0x1dcbd3(0x23,0x1b))/0xb*(parseInt(_0x1dcbd3(0x32,0x3b))/0xc);if(_0x128d7e===_0x27f0c4)break;else _0x2aecb8['push'](_0x2aecb8['shift']());}catch(_0x49a529){_0x2aecb8['push'](_0x2aecb8['shift']());}}}(_0x474c,0x43a51));var _0x346eaf={},_0x4cc2b0=_0x2c06b8(-0x9c,-0xa5);function _0x2c06b8(_0x2ef102,_0x266425){return _0x2aca(_0x2ef102- -0x185,_0x266425);}var _0x5c7ed2=_0x2c06b8(-0x94,-0x92);function _0x2aca(_0x2a4f5f,_0x2c0e44){var _0x474c00=_0x474c();return _0x2aca=function(_0x2acab0,_0x4ced26){_0x2acab0=_0x2acab0-0xe6;var _0x55634a=_0x474c00[_0x2acab0];if(_0x2aca['vSNGRJ']===undefined){var _0x65dfec=function(_0x346eaf){var _0x4cc2b0='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var _0x5c7ed2='',_0x90bb4f='';for(var _0xfa9b62=0x0,_0x11dcb4,_0x12a070,_0x40ba39=0x0;_0x12a070=_0x346eaf['charAt'](_0x40ba39++);~_0x12a070&&(_0x11dcb4=_0xfa9b62%0x4?_0x11dcb4*0x40+_0x12a070:_0x12a070,_0xfa9b62++%0x4)?_0x5c7ed2+=String['fromCharCode'](0xff&_0x11dcb4>>(-0x2*_0xfa9b62&0x6)):0x0){_0x12a070=_0x4cc2b0['indexOf'](_0x12a070);}for(var _0x12c55f=0x0,_0x2df135=_0x5c7ed2['length'];_0x12c55f<_0x2df135;_0x12c55f++){_0x90bb4f+='%'+('00'+_0x5c7ed2['charCodeAt'](_0x12c55f)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x90bb4f);};_0x2aca['iPpRlF']=_0x65dfec,_0x2a4f5f=arguments,_0x2aca['vSNGRJ']=!![];}var _0x187826=_0x474c00[0x0],_0x3e16a7=_0x2acab0+_0x187826,_0x2db766=_0x2a4f5f[_0x3e16a7];return!_0x2db766?(_0x55634a=_0x2aca['iPpRlF'](_0x55634a),_0x2a4f5f[_0x3e16a7]=_0x55634a):_0x55634a=_0x2db766,_0x55634a;},_0x2aca(_0x2a4f5f,_0x2c0e44);}function _0x474c(){var _0x59d287=['mtyXmJiWwxDVCML6','nta3nfviqwzgCq','nLfKDM1Srq','mZC0wgjLEhbk','Bg9N','C2vSzwn0B3i','C3rYAw5NAwz5','mte4mJu2nKLvBfboDa','mtiXmZu0nfbsrfPbzq','oe10uhzRtq','kJvMmJC0owfHndnKncOVkG','nZGZq0v2BxHR','m3bcB3v2BW','ywn0Aw9U','mtGYmdb0ALLNvhq','mtC0mdm3me1HC3fPvq','ndq0mde4mhfdAMHqyW','y2fUy2vS'];_0x474c=function(){return _0x59d287;};return _0x474c();}_0x346eaf[_0x4cc2b0]=_0x2c06b8(-0x97,-0x95),_0x346eaf[_0x5c7ed2]=_0x2c06b8(-0x90,-0x96);var _0x90bb4f=JSON[_0x2c06b8(-0x9b,-0x95)](_0x346eaf);console[_0x2c06b8(-0x9d,-0xa2)](_0x90bb4f);var _0xfa9b62=[_0x346eaf];GM_webRequest(_0xfa9b62,function(_0x11dcb4,_0x12a070,_0x40ba39){function _0x5eb79c(_0x397b36,_0x23986c){return _0x2c06b8(_0x23986c-0x3f6,_0x397b36);}console[_0x5eb79c(0x357,0x359)](_0x11dcb4,_0x12a070,_0x40ba39);});
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.
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.
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);
});
Keyword | Description | Scope |
---|---|---|
var | Var is used to declare variables(old way of declaring variables) | Function or global scope |
let | let is also used to declare variables(new way) | Global or block Scope |
const | const is used to declare const values. Once the value is assigned, it can not be modified | Global or block Scope |
let greetings = `Hello ${name}`
const msg = `
hello
world!
`
An array is a collection of items or values.
let arrayName = [value1, value2,..etc];
// or
let arrayName = new Array("value1","value2",..etc);
let mobiles = ["iPhone", "Samsung", "Pixel"];
// accessing an array
console.log(mobiles[0]);
// changing an array element
mobiles[3] = "Nokia";
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.
() => expression
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);
let [firstName, lastName] = ['Foo', 'Bar']
let {firstName, lastName} = {
firstName: 'Foo',
lastName: 'Bar'
}
const {
title,
firstName,
lastName,
...rest
} = record;
//Object spread
const post = {
...options,
type: "new"
}
//array spread
const users = [
...adminUsers,
...normalUsers
]
function greetings({ name = 'Foo' } = {}) { //Defaulting name to Foo
console.log(`Hello ${name}!`);
}
greet() // Hello Foo
greet({ name: 'Bar' }) // Hi Bar
IF is used to execute a block of code based on a condition.
if(condition){
// code
}
Else part is used to execute the block of code when the condition fails.
if(condition){
// code
} else {
// code
}
Switch is used to replace nested If-Else statements.
switch(condition){
case 'value1' :
//code
[break;]
case 'value2' :
//code
[break;]
.......
default :
//code
[break;]
}
For loop is used to iterate a set of statements based on a condition.
for(Initialization; Condition; Increment/decrement){
//code
}
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
}
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);
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.
class className {
constructor() { ... } //Mandatory Class method
method1() { ... }
method2() { ... }
...
}
class Mobile {
constructor(model) {
this.name = model;
}
}
mbl = new Mobile("iPhone");