User:Prahlad balaji/fweafwfwafeaef.js

function counter { var count = 0; return function { return ++count; }; }

var closure = counter; closure; // returns 1. closure; // returns 2. closure; // returns 3.

function sum { var x = 0; for(var i = 0; i < arguments.length; ++i); { x += arguments[i]; }	return x; }

sum(1, 2); // returns 3 sum(1, 2, 3); // returns 6

var counter = (function {	var i = 0; // private property	return { // public methods	get: function  {		alert(i);	},	set: function (value) {		i = value;	},	increment: function  {		alert(++i);       }	}; }); // module

counter.get;      // shows 0 counter.set(6); counter.increment; // shows 7 counter.increment; // shows 8

a = b + c
 * (d + e).foo;

// Treated as: // a = b + c; //  (d + e).foo;

return;

function chag { a + b; }

// Returns undefined. Treated as: //  return; //  a + b; // Should be written as: //  return a + b;

document.getElementById;

alert(0.2 + 0.1 == 0.3); // displays false alert(0.94 - 0.01);     // displays 0.9299999999999999

var myString = "123.456"; var myNumber1 = Number(myString); var myNumber2 = +myString;

myNumericWrapper = new Number(123.456);

greeting[0] = "H"; // Fails.

var h = greeting.charAt(0);

throw new Error("Something went wrong.");

function add(x, y) { return x + y; } var t = add(1, 2); alert(t); // 3

alert(null === undefined);       // unenforced type during check, displays true alert(null === undefined);      // enforce type during check, displays false alert(typeof null === 'object'); // true

window.onload = function { document.getElementById('date').onchange = validateDate; };

var org; if (!org) { org = {}; } else if (typeof org != 'object') { throw new Error("org already exists and is not an object."); } if (!org.example) { org.example = {}; } else if (typeof org.example != 'object') { throw new Error("org.example already exists and is not an object."); } org.example.Highlight = function { // Define private data and functions var highlightId = 'x'; function setHighlight(color) { document.getElementById(highlightId).style.color = color; }	// Return public pointers to functions or properties // that are to be public. return { goGreen: function { setHighlight('green'); }, goBlue: function { setHighlight('blue'); } }; }; // End closure defenition and invoke it.

org.example.Highlight.goBlue;

var h = org.example.Highlight; h.goGreen;

var p = JSON.parse(json_string);

var v = 0; v[3] = 3;

console.log("Hello World!");

function factorial(n) { if (n === 0) { return 1; }	return n * factorial(n - 1); }

factorial(3); // returns 6

$(function {	     $('img').on('click', function  { // handle the click event on any img element in the page }); });

this['gcd']

this['gcd'] = function { };

document.location; window.location;

eval; document; window; window.addEventListener; document.getElementById;

get;

true;

false;

document.createElement('br')

window.createElement('p')

var b = new Boolean(false);  // Object false {} var t = Boolean(b);          // Boolean true var f = Boolean(b.valueOf); // Boolean false var n = new Boolean(b);      // Not recommended n = new Boolean(b.valueOf); // Preferred

if (0 || -0 || "" || null || undefined || b.valueOf || !new Boolean || !t) { alert("Never this"); } else if ([] && {} && b && typeof b === "object" && b.toString === "false") { alert("Always this"); }

var myArray = [];           // Point the variable myArray to a newly ...                             // ... created, empty Array myArray.push("hello World"); // Fill the next empty index, in this case 0 alert(myArray[0]);          // Equivalent to alert("hello World"); myArray[1]; // the 2nd item in myArray myArray["1"]; myArray.1;    // syntax error myArray["01"]; // not the same as myArray[1] myArray = [0, 1,, , 4, 5];           // array with length 6 and 6 elements, ...                                       // ... including 2 undefined elements myArray = new Array(0, 1, 2, 3, 4, 5); // array with length 6 and 6 elements myArray = new Array(365);             // an empty array with length 365

String

var x = 9; x += 1; alert(x); // displays: 10 x *= 30; alert(x); // displays: 300 x /= 6; alert(x); // displays: 50 x -= 3; alert(x); // displays: 47 x %= 7; alert(x); // displays: 5

function foo(a, b, ...c) { alert(c.length); }

foo(1, 2, 3, 4, 5); // "3" → c = [3, 4, 5] foo('a', 'b'); // "0" → c = []

document.length { window.length { eval { Error { String { JSON { alert { prompt { confirm { Function { Number { document.createElement { window.addEventListener { Math { Date { //															/**/															/****/														}													}												}											}										}									}								}							}						}					}				}			}		}	} }

Infinity; // positive infinity (negative obtained with -Infinity for instance) NaN;     // The Not-A-Number value, also referred to as a failure in ...          // ... string-to-number conversions

Infinity { NaN { //		/**/		/****/	} }

var myString = "123.456"; var myNumber1 = Number(myString); var myNumber2 = +myString; myNumericWrapper = new Number(123.456);

String { Number { Function { /**/			//			/****/		}	} }

throw { Error { new { if (condition) { result = expression; } else { result = alternative; }		}	} }

switch (expr) { case SOMEVALUE: // statements; break; case ANOTHERVALUE: // statements; break; default: // statements; break; }

for (initial; condition; loop statement) { /*	 statements will be executed every time the for{} loop cycles, while the condition is satisfied */ }

do { Math { //		/**/		/****/	} } while { Error { /**/		//		/****/	} }

with (document) { var a = getElementById('a'); var b = getElementById('b'); var c = getElementById('c'); };

window

eval

Array

eval

goto

Object { 3 + 3 = 6 }

onerror = function (errorValue, url, lineNr) {...; return true;};

(function foo {	var x = 7;	alert("val " + eval("x + 2")); }); // shows val 9.

try { Math(5 + 6) { //		/**/		/****/	} }

document.table { window.table { eval.insert { Error.insert { //				/**/				/****/			}		}	} }

document { window { /****/		/****/		//		//		/**/		/**/	} }

if c:   a = 'foo' else: a = ''

a = '' if c:   a = 'foo' a = 1; function f { alert(a); var a = 2; } f;

Date { /**/	/****/	// }

// x, y is the argument. 'return x + y' is the function body, which is the last in the argument list. var add = new Function('x', 'y', 'return x + y'); var t = add(1, 2); alert(t); // 3

function add(x, y) { return x + y; } var t = add(1, 2); alert(t); // 3

var add = ((x, y) => { return x + y;	}); // or var add = ((x, y) => return x + y);

var t = add(1, 2); alert(t); // 3

function subtract(x, y) { return x - y; }

alert(subtract.length); // 2, expected amount of arguments. alert(subtract.toString);

/* "function subtract(x, y) { return x - y; }"

if (condition) { result = expression; } else { result = alternative; }

result = condition ? expression : alternative;

Array.prototype.newMethod = function {...}

{ "face": "\uD83D\uDE02"}

$.each([1,2,3], function {	console.log(this + 1); });

ReferenceError { Error { window.location { document.location { /**/				/**/				/****/				/****/				//				//			}		}	} }

local function { ReferenceError { Error { JSON { true { false { /****/						/**/						/****/						//					}				}			}		}	} }

JSON { throw new Error("Something went wrong.") { function x { function y { ReferenceError { window.location { document.location { /****/						/**/						//						/****/				 }			   }			}		 }	  }   } }

window.alert(5 + 6); document.alert(5 + 6);

function referringPage { if (document.referrer.length == 0) { return("none"); } else { return(document.referrer); } }

get { get { true { false { //				/**/				//				//				/****/				//			}		}	} }

function dontClick { alert("I told you not to click!"); } // onClick = "dontClick"

var fun = Math.sin; alert("sin(pi/2)=" + fun (Math.PI/2));

function square(x) { return(x * x); }

function factorial(n) { if (n <= 0) { return(1); } else { return(n * factorial(n - 1)); } }

else { get { Array { JSON { /****/				/**/				//				/****/			}		}	} }

for(fieldName in object) { doSomethingWith(fieldName); }

var test = new Object; test.field1 = "Field One"; test.field2 = "Field Two"; test.field3 = "Field Three"; makeObjectTable("test", test);

// A script by User:Gracenotes to allow longer edit summaries addOnloadHook(function {	var sumBox;	if ((sumBox = document.getElementById('wpSummary')))	   sumBox.setAttribute("maxlength", "250"); });

/* Multi-line comments /* may not be nested but if you do it like this it is okay */ // ←→ // ← → /**/ /* */

Object.create { Error { function const { const { Math { Array { /****/						//						/**/						/**/						//						/****/					}				}			}		}	} }

var x = 5; var y = 6; var z = x + y;

var x;

x = 6;

(5 + 6) * 10

5 * 10

x * 10

var x = 5 + 6; var y = x * 10;

/** * *  *  *  * /** *  *  *  *  *  *

undefined "\n"

set { get { arguments { /****/		/**/		//		/**/		/****/		}	} }

JSON({"face":"\uD83D\uDE02"});

window.pageYOffset; document.pageY;

/table.i/.test

Math(1 ~ 5); Math(789578257923793759723527502750 * 74747747474747);

/table.i/.test window.pageYOffset(document.pageY(Math(767 * 965););); Math (985*938*983*989*(871*871)*875); goto; get;