Search completed in 1.04 seconds.
undefined - JavaScript
the global
undefined property represents the primitive value
undefined.
... property attributes of
undefined writable no enumerable no configurable no the source for this interactive example is stored in a github repository.
... syntax
undefined description
undefined is a property of the global object.
...And 13 more matches
JS_SetAllNonReservedSlotsToUndefined
this article covers features introduced in spidermonkey 24 assign
undefined to all of the object's non-reserved slots.
... syntax void js_setallnonreservedslotsto
undefined(jscontext *cx, jsobject *objarg); name type description cx jscontext * the context in which to clear the object.
... description js_setallnonreservedslotsto
undefined assignes
undefined to all of obj's own properties, except the special __proto__ and __parent__ properties, in a single operation.
...see also mxr id search for js_setallnonreservedslotsto
undefined bug 749371 ...
ReferenceError: reference to undefined property "x" - JavaScript
the javascript warning "reference to
undefined property" occurs when a script attempted to access an object property which doesn't exist.
... message referenceerror: reference to
undefined property "x" (firefox) error type (firefox only) referenceerror warning which is reported only if javascript.options.strict preference is set to true.
... examples invalid cases in this case, the property bar is an
undefined property, so a referenceerror will occur.
... var foo = {}; foo.bar; // referenceerror: reference to
undefined property "bar" valid cases to avoid the error, you need to either add a definition for bar to the object or check for the existence of the bar property before trying to access it; one way to do that is to use the object.prototype.hasownproperty() method), like this: var foo = {}; // define the bar property foo.bar = 'moon'; console.log(foo.bar); // "moon" // test to be sure bar exists before accessing it if (foo.hasownproperty('bar')) { console.log(foo.bar); } ...
JS::UndefinedHandleValue
this article covers features introduced in spidermonkey 24 the js::value that represents the javascript value
undefined.
... syntax const js::handlevalue js::
undefinedhandlevalue; description js::
undefinedhandlevalue is a js::handlevalue constant that represents the javascript value
undefined.
... see also mxr id search for js::
undefinedhandlevalue js::nullhandlevalue js::truehandlevalue js::falsehandlevalue bug 865969 ...
JS::UndefinedValue
this article covers features introduced in spidermonkey 24 create a js::value that represents the javascript value
undefined.
... syntax js::value js::
undefinedvalue(); description js::
undefinedvalue creates a js::value that represents the javascript value
undefined.
... see also mxr id search for js::
undefinedvalue js::value js::
undefinedhandlevalue ...
undefined - MDN Web Docs Glossary: Definitions of Web-related terms
undefined is a primitive value automatically assigned to variables that have just been declared, or to formal arguments for which there are no actual arguments.
... example var x; //create a variable but assign it no value console.log("x's value is", x) //logs "x's value is
undefined" learn more general knowledge
undefined value on wikipedia technical reference javascript data types and data structures ...
Debugger.Object - Firefox Developer Tools
if the referent is an anonymous function, or not a function at all, this is
undefined.
...if the referent is not a function, or if it has no display name, this is
undefined.
...if the referent is not a debuggee function, or not a function at all, this is
undefined.
...And 20 more matches
Bytecode Descriptions
constants
undefined stack: ⇒
undefined push
undefined.
... expressions unary operators void stack: val ⇒
undefined pop the top value on the stack, discard it, and push
undefined.
...this is how we implement typeof step 2, making typeof nonexistingvariable return "
undefined" instead of throwing a referenceerror.
...And 19 more matches
Index
83 js::
undefinedhandlevalue jsapi reference, reference, référence(2), spidermonkey js::
undefinedhandlevalue is a js::handlevalue constant that represents the javascript value
undefined.
... 84 js::
undefinedvalue jsapi reference, reference, référence(2), spidermonkey js::
undefinedvalue creates a js::value that represents the javascript value
undefined.
... 85 js::value jsapi reference, spidermonkey a c++ variable of type js::value represents a value in javascript: a string, number, object (including arrays and functions), boolean, symbol, null, or
undefined.
...And 15 more matches
Assert.jsm
method overview
undefined ok(value, message);
undefined equal(actual, expected, message);
undefined notequal(actual, expected, message);
undefined deepequal(actual, expected, message);
undefined notdeepequal(actual, expected, message);
undefined strictequal(actual, expected, message);
undefined notstrictequal(actual, expected, message);
undefined throws(block,...
... expected, message); promise rejects(promise, expected, message);
undefined greater(lhs, rhs, message);
undefined greaterorequal(lhs, rhs, message);
undefined less(lhs, rhs, message);
undefined lessorequal(lhs, rhs, message);
undefined setreporter(reporterfunc);
undefined report(failed, actual, expected, message, operator); constructor creates a new assert object.
...
undefined ok( actual, message ); parameters actual test subject to be evaluated as truthy message short explanation of the expected result equal() the equality assertion tests shallow, coercive equality with ==.
...And 14 more matches
Index - Web APIs
120 audiobuffersourcenode.start() api, audio, audiobuffersourcenode, media, method, reference, web audio api, sound, start
undefined.
...in some browsers, older implementations of this interface return
undefined.
... 162 audionode.disconnect() api, audio, audionode, disconnect, method, reference, web audio api
undefined 163 audionode.numberofinputs api, audionode, property, reference, web audio api, numberofinputs the numberofinputs property of the audionode interface returns the number of inputs feeding the node.
...And 14 more matches
Optional chaining (?.) - JavaScript
chaining operator, except that instead of causing an error if a reference is nullish (null or
undefined), the expression short-circuits with a return value of
undefined.
... when used with function calls, it returns
undefined if the given function does not exist.
... syntax obj?.prop obj?.[expr] arr?.[index] func?.(args) description the optional chaining operator provides a way to simplify accessing values through connected objects when it's possible that a reference or function may be
undefined or null.
...And 11 more matches
jspage - Archive of obsolete content
ngth;b<a;b++){c.call(d,this[b],b,this);}}});array.alias("foreach","each"); function $a(b){if(b.item){var a=b.length,c=new array(a);while(a--){c[a]=b[a];}return c;}return array.prototype.slice.call(b);}function $arguments(a){return function(){return arguments[a]; };}function $chk(a){return !!(a||a===0);}function $clear(a){cleartimeout(a);clearinterval(a);return null;}function $defined(a){return(a!=
undefined);}function $each(c,b,d){var a=$type(c); ((a=="arguments"||a=="collection"||a=="array")?array:hash).each(c,b,d);}function $empty(){}function $extend(c,a){for(var b in (a||{})){c[b]=a[b];}return c; }function $h(a){return new hash(a);}function $lambda(a){return($type(a)=="function")?a:function(){return a;};}function $merge(){var a=array.slice(arguments); a.unshift({});return $mixin.apply(null,a);}fu...
...nction $mixin(e){for(var d=1,a=arguments.length;d<a;d++){var b=arguments[d];if($type(b)!="object"){continue; }for(var c in b){var g=b[c],f=e[c];e[c]=(f&&$type(g)=="object"&&$type(f)=="object")?$mixin(f,g):$unlink(g);}}return e;}function $pick(){for(var b=0,a=arguments.length; b<a;b++){if(arguments[b]!=
undefined){return arguments[b];}}return null;}function $random(b,a){return math.floor(math.random()*(a-b+1)+b);}function $splat(b){var a=$type(b); return(a)?((a!="array"&&a!="arguments")?[b]:b):[];}var $time=date.now||function(){return +new date;};function $try(){for(var b=0,a=arguments.length;b<a; b++){try{return arguments[b]();}catch(c){}}return null;}function $type(a){if(a==
undefined){return false;}if(a.$family){return(a.$family.name=="number"&&!isfinite(a))?false:a.$family.name; }if(a.nodename){sw...
...rn"arguments"; }else{if(a.item){return"collection";}}}}return typeof a;}function $unlink(c){var b;switch($type(c)){case"object":b={};for(var e in c){b[e]=$unlink(c[e]); }break;case"hash":b=new hash(c);break;case"array":b=[];for(var d=0,a=c.length;d<a;d++){b[d]=$unlink(c[d]);}break;default:return c;}return b;}var browser=$merge({engine:{name:"unknown",version:0},platform:{name:(window.orientation!=
undefined)?"ipod":(navigator.platform.match(/mac|win|linux/i)||["other"])[0].tolowercase()},features:{xpath:!!(document.evaluate),air:!!(window.runtime),query:!!(document.queryselector)},plugins:{},engines:{presto:function(){return(!window.opera)?false:((arguments.callee.caller)?960:((document.getelementsbyclassname)?950:925)); },trident:function(){return(!window.activexobject)?false:((window.xmlhttpreques...
...And 10 more matches
A re-introduction to JavaScript (JS tutorial) - JavaScript
oh, and
undefined and null, which are ...
...so the type diagram looks more like this: number string boolean symbol (new in es2015) object function array date regexp null
undefined and there are some built-in error types as well.
...they have methods as well that allow you to manipulate the string and access information about the string: 'hello'.charat(0); // "h" 'hello, world'.replace('world', 'mars'); // "hello, mars" 'hello'.touppercase(); // "hello" other types javascript distinguishes between null, which is a value that indicates a deliberate non-value (and is only accessible through the null keyword), and
undefined, which is a value of type
undefined that indicates an uninitialized variable — that is, a value hasn't even been assigned yet.
...And 10 more matches
Nullish coalescing operator (??) - JavaScript
the nullish coalescing operator (??) is a logical operator that returns its right-hand side operand when its left-hand side operand is null or
undefined, and otherwise returns its left-hand side operand.
... contrary to the logical or (||) operator, the left operand is returned if it is a falsy value which is not null or
undefined.
...rightexpr examples using the nullish coalescing operator in this example, we will provide default values but keep values other than null or
undefined.
...And 10 more matches
Debugger.Object - Firefox Developer Tools
if the referent is an anonymous function, or not a function at all, this is
undefined.
...if the referent is not a function, or if it has no display name, this is
undefined.
...if the referent is not a debuggee function, or not a function at all, this is
undefined.
...And 8 more matches
Grammar and types - JavaScript
evaluating variables a variable declared using the var or let statement with no assigned value specified has the value of
undefined.
... an attempt to access an undeclared variable results in a referenceerror exception being thrown: var a; console.log('the value of a is ' + a); // the value of a is
undefined console.log('the value of b is ' + b); // the value of b is
undefined var b; // this one may puzzle you until you read 'variable hoisting' below console.log('the value of c is ' + c); // uncaught referenceerror: c is not defined let x; console.log('the value of x is ' + x); // the value of x is
undefined console.log('the value of y is ' + y); // uncaught referenceerror: y is not defined let y; you can use
undefined to determine whether a variable has a value.
... var input; if (input ===
undefined) { dothis(); } else { dothat(); } the
undefined value behaves as false when used in a boolean context.
...And 8 more matches
Default parameters - JavaScript
default function parameters allow named parameters to be initialized with default values if no value or
undefined is passed.
... syntax function [name]([param1[ = defaultvalue1 ][, ..., paramn[ = defaultvaluen ]]]) { statements } description in javascript, function parameters default to
undefined.
... in the past, the general strategy for setting defaults was to test parameter values in the function body and assign a value if they are
undefined.
...And 8 more matches
Old Proxy API - Archive of obsolete content
the this-binding of the constructtrap is either
undefined (in strict mode) or the global object (in non-strict mode).
...if the derived trap is
undefined, a default implementation using the fundamental traps is used.
... fundamental traps emulated javascript code handler method description object.getownpropertydescriptor(proxy, name) getownpropertydescriptor: function(name) -> propertydescriptor |
undefined should return a valid property descriptor object, or
undefined to indicate that no property with name exists in the emulated object.
...And 7 more matches
Border-image generator - CSS: Cascading Style Sheets
r_left); node.appendchild(input); node.appendchild(slider_right); this.input = input; sliders[topic] = this; setvalue(topic, value); }; inputslider.prototype.setinputvalue = function setinputvalue() { this.input.value = this.value.tofixed(this.precision) + this.unit; }; var setvalue = function setvalue(topic, value, send_notify) { var slider = sliders[topic]; if (slider ===
undefined) return; value = parsefloat(value.tofixed(slider.precision)); if (value > slider.max) value = slider.max; if (value < slider.min) value = slider.min; slider.value = value; slider.node.setattribute('data-value', value); slider.setinputvalue(); if (send_notify === false) return; notify.call(slider); }; var setmax = function setmax(topic, value) { var slider = slider...
...s[topic]; if (slider ===
undefined) return; slider.max = value; setvalue(topic, slider.value); }; var setmin = function setmin(topic, value) { var slider = sliders[topic]; if (slider ===
undefined) return; slider.min = value; setvalue(topic, slider.value); }; var setunit = function setunit(topic, unit) { var slider = sliders[topic]; if (slider ===
undefined) return; slider.unit = unit; setvalue(topic, slider.value); }; var setstep = function setstep(topic, value) { var slider = sliders[topic]; if (slider ===
undefined) return; slider.step = parsefloat(value); setvalue(topic, slider.value); }; var setprecision = function setprecision(topic, value) { var slider = sliders[topic]; if (slider ===
undefined) return; value = value | 0; ...
...slider.precision = value; var step = parsefloat(slider.step.tofixed(value)); if (step === 0) slider.step = 1 / math.pow(10, value); setvalue(topic, slider.value); }; var setsensivity = function setsensivity(topic, value) { var slider = sliders[topic]; if (slider ===
undefined) return; value = value | 0; slider.sensivity = value > 0 ?
...And 7 more matches
var - JavaScript
default value is
undefined.
...their initial value is
undefined.
... 'use strict'; console.log(x); //
undefined (note: not referenceerror) console.log('still going...'); // still going...
...And 7 more matches
Shell global objects
elementattributename if present and not
undefined, the name of property of element that holds this code.
... elementattributename if present and not
undefined, the name of property of element that holds this code.
... objectemulating
undefined() return a new object obj for which typeof obj === "
undefined", obj == null and obj ==
undefined (and vice versa for !=), and toboolean(obj) === false.
...And 6 more matches
Debugger - Firefox Developer Tools
on a new debugger instance, each of these properties is initially
undefined.
... any value assigned to a debugging handler must be either a function or
undefined; otherwise a typeerror is thrown.
...however, note that a { return:value } resumption value is treated like
undefined (“continue normally”);value is ignored.
...And 6 more matches
Using IndexedDB - Web APIs
when you've reached the end of the data (or if there were no entries that matched your opencursor() request) you still get a success callback, but the result property is
undefined.
...onfailure(this.error); }; } function getblob(key, store, success_callback) { var req = store.get(key); req.onsuccess = function(evt) { var value = evt.target.result; if (value) success_callback(value.blob); }; } /** * @param {idbobjectstore=} store */ function displaypublist(store) { console.log("displaypublist"); if (typeof store == '
undefined') store = getobjectstore(db_store_name, 'readonly'); var pub_msg = $('#pub-msg'); pub_msg.empty(); var pub_list = $('#pub-list'); pub_list.empty(); // resetting the iframe so that it doesn't display previous content newviewerframe(); var req; req = store.count(); // requests are executed in the order in which they were made against the // transactio...
... var list_item = $('<li>' + '[' + cursor.key + '] ' + '(biblioid: ' + value.biblioid + ') ' + value.title + '</li>'); if (value.year != null) list_item.append(' - ' + value.year); if (value.hasownproperty('blob') && typeof value.blob != '
undefined') { var link = $('<a href="' + cursor.key + '">file</a>'); link.on('click', function() { return false; }); link.on('mouseenter', function(evt) { setinviewer(evt.target.getattribute('href')); }); list_item.append(' / '); list_item.append(link); } else { list_item.append(" / no attached file"); ...
...And 6 more matches
Box-shadow generator - CSS: Cascading Style Sheets
d(input); node.appendchild(unit); input.addeventlistener('click', function(e) { this.select(); }); input.addeventlistener('change', function(e) { setvalue(topic, e.target.value | 0); }); subscribe(topic, function(value) { node.children[0].value = value; }); } var increment = function increment(topic) { var slider = sliders[topic]; if (slider === null || slider ===
undefined) return; if (slider.value + slider.step <= slider.max) { slider.value += slider.step; setvalue(slider.topic, slider.value) notify.call(slider); } }; var decrement = function decrement(topic) { var slider = sliders[topic]; if (slider === null || slider ===
undefined) return; if (slider.value - slider.step >= slider.min) { slider.value -= slider.step; setvalue(to...
... var setmousetracking = function setmousetracking(elem, callback) { elem.addeventlistener("mousedown", function(e) { callback(e); document.addeventlistener("mousemove", callback); }); document.addeventlistener("mouseup", function(e) { document.removeeventlistener("mousemove", callback); }); } var subscribe = function subscribe(topic, callback) { if (subscribers[topic] ===
undefined) subscribers[topic] = []; subscribers[topic].push(callback); } var unsubscribe = function unsubscribe(topic, callback) { subscribers[topic].indexof(callback); subscribers[topic].splice(index, 1); } var notify = function notify() { if (subscribers[this.topic] ===
undefined) return; for (var i in subscribers[this.topic]) { subscribers[this.topic][i](this.value); } } v...
...d(this)); buttons[topic] = this; } var getnode = function getnode(topic) { return buttons[topic].node; } var setvalue = function setvalue(topic, value) { try { buttons[topic].checkbox.checked = value; notify.call(buttons[topic]); } catch(error) { console.log(error, topic, value); } } var subscribe = function subscribe(topic, callback) { if (subscribers[topic] ===
undefined) subscribers[topic] = []; subscribers[topic].push(callback); } var unsubscribe = function unsubscribe(topic, callback) { subscribers[topic].indexof(callback); subscribers[topic].splice(index, 1); } var notify = function notify() { if (subscribers[this.topic] ===
undefined) return; for (var i = 0; i < subscribers[this.topic].length; i++) subscribers[this.topic][i](this.ch...
...And 6 more matches
Linear-gradient Generator - CSS: Cascading Style Sheets
ickermode(topic, mode) { if (pickers[topic]) pickers[topic].setpickermode(mode); }; var setcolor = function setcolor(topic, color) { if (pickers[topic]) pickers[topic].setcolor(color); }; var getcolor = function getcolor(topic) { if (pickers[topic]) return new color(pickers[topic].color); }; var subscribe = function subscribe(topic, callback) { if (subscribers[topic] ===
undefined) subscribers[topic] = []; subscribers[topic].push(callback); }; var unsubscribe = function unsubscribe(callback) { subscribers.indexof(callback); subscribers.splice(index, 1); }; var notify = function notify(topic, value) { if (subscribers[topic] ===
undefined || subscribers[topic].length === 0) return; var color = new color(value); for (var i in subscribers[topic]) s...
...v'); dropdown.setattribute('data-topic', topic); dropdown.classname = 'ui-dropdown'; for (var i in options) { var x = document.createelement('div'); x.setattribute('data-value', i); x.textcontent = options[i]; dropdown.appendchild(x); } new dropdown(dropdown); return dropdown; }; var setvalue = function setvalue(topic, index, send_notify) { if (dropdowns[topic] ===
undefined || index >= dropdowns[topic].dropmenu.children.length) return; dropdowns[topic].setnodevalue(dropdowns[topic].dropmenu.children[index], send_notify); }; var subscribe = function subscribe(topic, callback) { if (subscribers[topic] ===
undefined) subscribers[topic] = []; subscribers[topic].push(callback); }; var unsubscribe = function unsubscribe(topic, callback) { var index...
... = subscribers[topic].indexof(callback); subscribers[topic].splice(index, 1); }; var notify = function notify() { if (subscribers[this.topic] ===
undefined) return; for (var i in subscribers[this.topic]) { subscribers[this.topic][i](this.value); } }; var init = function init() { var elem, size; elem = document.queryselectorall('.ui-dropdown'); size = elem.length; for (var i = 0; i < size; i++) new dropdown(elem[i]); }; return { init : init, setvalue : setvalue, subscribe : subscribe, unsubscribe : unsubscribe, createdropdown : createdropdown }; })(); /** * ui-slidersmanager */ var inputslidermanager = (function inputslidermanager() { 'use strict'; var subscribers = {}; var sliders = []; var inputcomponent = function inputcomponent(obj) { ...
...And 6 more matches
Equality comparisons and sameness - JavaScript
var num = 0; var obj = new string('0'); var str = '0'; console.log(num === num); // true console.log(obj === obj); // true console.log(str === str); // true console.log(num === obj); // false console.log(num === str); // false console.log(obj === str); // false console.log(null ===
undefined); // false console.log(obj === null); // false console.log(obj ===
undefined); // false strict equality is almost always the correct comparison operation to use.
... the equality comparison is performed as follows for operands of the various types: operand b
undefined null number string boolean object operand a
undefined true true false false false false null true true false false false false number false false a === b a === tonumber(b) a === tonumber(b) a == toprimitive(b) string false false tonumber(a) === b a === b tonumber(a) === tonum...
... traditionally, and according to ecmascript, all objects are loosely unequal to
undefined and null.
...And 6 more matches
Object.defineProperty() - JavaScript
defaults to
undefined.
... an accessor descriptor also has the following optional keys: get a function which serves as a getter for the property, or
undefined if there is no getter.
... defaults to
undefined.
...And 6 more matches
Promise
this may be any value, including
undefined.
...this may be any value, including
undefined, though it is generally an error object, like in exception handling.
... void resolve( avalue ); parameters avalue optional if this value is not a promise, including
undefined, it becomes the fulfillment value of the associated promise.
...And 5 more matches
Debugger.Source - Firefox Developer Tools
(note that code passed to eval, the function constructor, or a similar function isnot considered to be loaded from a url; the url accessor on debugger.source instances for such sources should return
undefined.) if the instance refers to webassembly code, the url of the script that called new webassembly.module with the string "> wasm" appended.
... element the debugger.object instance referring to the dom element to which this source code belongs, if any, or
undefined if it belongs to no dom element.
...otherwise, this is
undefined.
...And 5 more matches
Color picker tool - CSS: Cascading Style Sheets
ickermode(topic, mode) { if (pickers[topic]) pickers[topic].setpickermode(mode); }; var setcolor = function setcolor(topic, color) { if (pickers[topic]) pickers[topic].setcolor(color); }; var getcolor = function getcolor(topic) { if (pickers[topic]) return new color(pickers[topic].color); }; var subscribe = function subscribe(topic, callback) { if (subscribers[topic] ===
undefined) subscribers[topic] = []; subscribers[topic].push(callback); }; var unsubscribe = function unsubscribe(callback) { subscribers.indexof(callback); subscribers.splice(index, 1); }; var notify = function notify(topic, value) { if (subscribers[topic] ===
undefined || subscribers[topic].length === 0) return; var color = new color(value); for (var i in subscribers[topic]) s...
...r_left); node.appendchild(input); node.appendchild(slider_right); this.input = input; sliders[topic] = this; setvalue(topic, value); }; inputslider.prototype.setinputvalue = function setinputvalue() { this.input.value = this.value.tofixed(this.precision) + this.unit; }; var setvalue = function setvalue(topic, value, send_notify) { var slider = sliders[topic]; if (slider ===
undefined) return; value = parsefloat(value.tofixed(slider.precision)); if (value > slider.max) value = slider.max; if (value < slider.min) value = slider.min; slider.value = value; slider.node.setattribute('data-value', value); slider.setinputvalue(); if (send_notify === false) return; notify.call(slider); }; var setmax = function setmax(topic, value) { var slider = slider...
...s[topic]; if (slider ===
undefined) return; slider.max = value; setvalue(topic, slider.value); }; var setmin = function setmin(topic, value) { var slider = sliders[topic]; if (slider ===
undefined) return; slider.min = value; setvalue(topic, slider.value); }; var setunit = function setunit(topic, unit) { var slider = sliders[topic]; if (slider ===
undefined) return; slider.unit = unit; setvalue(topic, slider.value); }; var setstep = function setstep(topic, value) { var slider = sliders[topic]; if (slider ===
undefined) return; slider.step = parsefloat(value); setvalue(topic, slider.value); }; var setprecision = function setprecision(topic, value) { var slider = sliders[topic]; if (slider ===
undefined) return; value = value | 0; ...
...And 5 more matches
Inheritance and the prototype chain - JavaScript
console.log(o.d); //
undefined // is there a 'd' own property on o?
...// o.[[prototype]].[[prototype]].[[prototype]] is null, stop searching, // no property found, return
undefined.
...then, and only then, after the entire prototype chain of __proto__'s is looked through, and there are no more __proto__s does the browser assert that the property does not exist and conclude that the value at the property is
undefined.
...And 5 more matches
Array.prototype.find() - JavaScript
otherwise,
undefined is returned.
...otherwise, find returns
undefined.
...if it is not provided, then
undefined is used.
...And 5 more matches
void operator - JavaScript
the void operator evaluates the given expression and then returns
undefined.
... syntax void expression description this operator allows evaluating expressions that produce a value into places where an expression that evaluates to
undefined is desired.
... the void operator is often used merely to obtain the
undefined primitive value, usually using "void(0)" (which is equivalent to "void 0").
...And 5 more matches
Download
promise resolves to
undefined when the download has finished successfully and you can access the target file.
... promise resolves to
undefined when the instruction to launch the file has been successfully given to the operating system.
... promise resolves to
undefined when the instruction to open the containing folder has been successfully given to the operating system.
...And 4 more matches
nsIFile
if this nsifile does not reference a symbolic link, then the value of this attribute is
undefined.
...as of gecko 1.7, changing the last modified time of a non-existent file has
undefined behavior.
...if this nsifile does not reference a symbolic link, then the value of this attribute is
undefined.
...And 4 more matches
Debugger.Frame - Firefox Developer Tools
offset the offset of the bytecode instruction currently being executed in script, or
undefined if the frame’s script property is null.
... debugger.frame instances inherit the following handler method properties: onstep this property must be either
undefined or a function.
...if any onstep handler forces the frame to return early (by returning a resumption value other than
undefined), any remaining debuggers’ onstep handlers do not run.
...And 4 more matches
JavaScript data types and data structures - JavaScript
directly associated with any particular value type, and any variable can be assigned (and re-assigned) values of all types: let foo = 42; // foo is now a number foo = 'bar'; // foo is now a string foo = true; // foo is now a boolean data and structure types the latest ecmascript standard defines nine types: six data types that are primitives, checked by typeof operator:
undefined : typeof instance === "
undefined" boolean : typeof instance === "boolean" number : typeof instance === "number" string : typeof instance === "string" bigint : typeof instance === "bigint" symbol : typeof instance === "symbol" null : typeof instance === "object".
...
undefined type a variable that has not been assigned a value has the value
undefined.
... see
undefined and
undefined for more details.
...And 4 more matches
JSON.stringify() - JavaScript
undefined, functions, and symbols are not valid json values.
...json.stringify() can return
undefined when passing in "pure" values like json.stringify(function(){}) or json.stringify(
undefined).
...-02t15:04:05.000z"' json.stringify({ x: 5, y: 6 }); // '{"x":5,"y":6}' json.stringify([new number(3), new string('false'), new boolean(false)]); // '[3,"false",false]' // string-keyed array elements are not enumerable and make no sense in json let a = ['foo', 'bar']; a['baz'] = 'quux'; // a: [ 0: 'foo', 1: 'bar', baz: 'quux' ] json.stringify(a); // '["foo","bar"]' json.stringify({ x: [10,
undefined, function(){}, symbol('')] }); // '{"x":[10,null,null,null]}' // standard data structures json.stringify([new set([1]), new map([[1, 2]]), new weakset([{a: 1}]), new weakmap([[{a: 1}, 2]])]); // '[{},{},{},{}]' // typedarray json.stringify([new int8array([1]), new int16array([1]), new int32array([1])]); // '[{"0":1},{"0":1},{"0":1}]' json.stringify([new uint8array([1]), new uint8clampedarray([1...
...And 4 more matches
function declaration - JavaScript
by default, functions return
undefined.
...typeof foo is
undefined // // in firefox: // 'foo' name is hoisted.
... typeof foo is
undefined // // in edge: // 'foo' name is not hoisted.
...And 4 more matches
JS_GetProperty
on success, *vp receives the current value of the property, or
undefined if no such property is found.
...if the lookup proceeds without error, exactly one of the following cases applies: if the property is not found, then *vp is set to
undefined.
...for many objects, including objects of standard classes such as object and array, this hook does nothing and returns true, so the property get succeeds and
undefined is left in *vp.
...And 3 more matches
DevTools API - Firefox Developer Tools
return value: toolbox object or
undefined if there's no toolbox for the given target..
... return value: the toolpanel object if the tool with the given toolid is active, otherwise
undefined.
... return value:
undefined.
...And 3 more matches
MediaDevices.getUserMedia() - Web APIs
constraints); /* use the stream */ } catch(err) { /* handle the error */ } } similarly, using the raw promises directly, the code looks like this: navigator.mediadevices.getusermedia(constraints) .then(function(stream) { /* use the stream */ }) .catch(function(err) { /* handle the error */ }); note: if the current document isn't loaded securely, navigator.mediadevices will be
undefined, and you cannot use getusermedia().
...this can also happen if you try to call getusermedia() in an insecure context, since navigator.mediadevices is
undefined in an insecure context.
... getusermedia() is a powerful feature which can only be used in secure contexts; in insecure contexts, navigator.mediadevices is
undefined, preventing access to getusermedia().
...And 3 more matches
Using the User Timing API - Web APIs
function create_marks(ev) { if (performance.mark ===
undefined) { log("create marks: performance.mark not supported", 0); return; } else { log("create marks", 0); // create several performance marks including two with the same name performance.mark("mark-1"); do_work(50000); performance.mark("mark-2"); do_work(50000); performance.mark("mark-2"); var marks = ["mark-1", "mark-2", "mark-2"]; for (var i=0; i < marks.length; i++) l...
... function display_marks(ev) { if (performance.getentries ===
undefined) { log("display marks: performance.getentries not supported", 0); return; } log("display marks", 0); // display each mark using getentries() var entries = performance.getentries(); var j=0; for (var i=0; i < entries.length; i++) { if (entries[i].entrytype == "mark") { if (j == 0) { log("= getentries()", 0); j++ } log("...
... function clear_marks(obj) { if (performance.clearmarks ===
undefined) { log("clear marks: performance.clearmarks not supported", 0); return; } log("clear marks", 0); if (typeof obj == "string") { log("...
...And 3 more matches
Functions - JavaScript
console.log(square) // square is hoisted with an initial value
undefined.
... default parameters in javascript, parameters of functions default to
undefined.
... without default parameters (pre-ecmascript 2015) in the past, the general strategy for setting defaults was to test parameter values in the body of the function and assign a value if they are
undefined.
...And 3 more matches
TypeError: "x" is (not) "y" - JavaScript
oftentimes, unexpected
undefined or null values.
... message typeerror: unable to get property {x} of
undefined or null reference (edge) typeerror: "x" is (not) "y" (firefox) examples: typeerror: "x" is
undefined typeerror: "x" is null typeerror: "
undefined" is not an object typeerror: "x" is not an object or null typeerror: "x" is not a symbol error type typeerror.
...this occurs oftentimes with
undefined or null values.
...And 3 more matches
Arrow function expressions - JavaScript
undefined in strict mode function calls.
...let's see what happens when we try to use them as methods: 'use strict'; var obj = { // does not create a new scope i: 10, b: () => console.log(this.i, this), c: function() { console.log(this.i, this); } } obj.b(); // prints
undefined, window {...} (or the global object) obj.c(); // prints 10, object {...} arrow functions do not have their own this.
... another example involving object.defineproperty(): 'use strict'; var obj = { a: 10 }; object.defineproperty(obj, 'b', { get: () => { console.log(this.a, typeof this.a, this); //
undefined '
undefined' window {...} (or the global object) return this.a + 10; // represents global object 'window', therefore 'this.a' returns '
undefined' } }); use of the new operator arrow functions cannot be used as constructors and will throw an error when used with new.
...And 3 more matches
Array.from() - JavaScript
item.value : item; if (isiterator && item.done) { return a; } else { if (mapfn) { a[k] = typeof t === '
undefined' ?
... if (arraylikeoriterator == null && !isiterator) { throw new typeerror( 'array.from requires an array-like object or iterator - not null or
undefined' ); } // 4.
... if mapfn is
undefined, then let mapping be false.
...And 3 more matches
Object.defineProperties() - JavaScript
defaults to
undefined.
... an accessor descriptor also has the following optional keys: get a function which serves as a getter for the property, or
undefined if there is no getter.
... defaults to
undefined.
...And 3 more matches
in operator - JavaScript
let color1 = new string('green') 'length' in color1 // returns true let color2 = 'coral' // generates an error (color2 is not a string object) 'length' in color2 using in with deleted or
undefined properties if you delete a property with the delete operator, the in operator returns false for that property.
... let mycar = {make: 'honda', model: 'accord', year: 1998} delete mycar.make 'make' in mycar // returns false let trees = new array('redwood', 'bay', 'cedar', 'oak', 'maple') delete trees[3] 3 in trees // returns false if you set a property to
undefined but do not delete it, the in operator returns true for that property.
... let mycar = {make: 'honda', model: 'accord', year: 1998} mycar.make =
undefined 'make' in mycar // returns true let trees = new array('redwood', 'bay', 'cedar', 'oak', 'maple') trees[3] =
undefined 3 in trees // returns true the in operator will return false for empty array slots.
...And 3 more matches
this - JavaScript
function f1() { return this; } // in a browser: f1() === window; // true // in node: f1() === globalthis; // true in strict mode, however, if the value of this is not set when entering an execution context, it remains as
undefined, as shown in the following example: function f2() { 'use strict'; // see strict mode return this; } f2() ===
undefined; // true in the second example, this should be
undefined, because f2 was called directly and not as a method or property of an object (e.g.
...values null and
undefined become the global object.
... function bar() { console.log(object.prototype.tostring.call(this)); } bar.call(7); // [object number] bar.call('foo'); // [object string] bar.call(
undefined); // [object global] the bind method ecmascript 5 introduced function.prototype.bind().
...And 3 more matches
typeof - JavaScript
type result
undefined "
undefined" null "object" (see below) boolean "boolean" number "number" bigint (new in ecmascript 2020) "bigint" string "string" symbol (new in ecmascript 2015) "symbol" function object (implements [[call]] in ecma-262 terms) "function" any other object "object" note: ecmascript 2019 and old...
...(logical not) operator are equivalent to boolean() // symbols typeof symbol() === 'symbol' typeof symbol('foo') === 'symbol' typeof symbol.iterator === 'symbol' //
undefined typeof
undefined === '
undefined'; typeof declaredbut
undefinedvariable === '
undefined'; typeof undeclaredvariable === '
undefined'; // objects typeof {a: 1} === 'object'; // use array.isarray or object.prototype.tostring.call // to differentiate regular objects from arrays typeof [1, 2, 4] === 'object'; typeof new date() === 'object'; typeof /regex/ === 'object'; // see regular expressions sect...
...even with undeclared identifiers, typeof will return '
undefined'.
...And 3 more matches
lang/type - Archive of obsolete content
globals functions is
undefined(value) returns true if value is
undefined, false otherwise.
... let { is
undefined } = require('sdk/lang/type'); var foo; is
undefined(foo); // true is
undefined(0); // false parameters value : mixed the variable to check.
... returns boolean : boolean indicating if value is
undefined.
...And 2 more matches
LiveConnect Overview - Archive of obsolete content
these conversions are described in the following sections: javascript to java conversions java to javascript conversions javascript to java conversions when you call a java method and pass it parameters from javascript, the data types of the parameters you pass in are converted according to the rules described in the following sections: number values boolean values string values
undefined values null values javaarray and javaobject objects javaclass objects other javascript objects the return values of methods of netscape.javascript.jsobject are always converted to instances of java.lang.object.
...
undefined values when you pass
undefined javascript values as parameters to java methods, java converts the values according to the rules described in the following table: java parameter type conversion rules java.lang.string java.lang.object the value is converted to an instance of java.lang.string whose value is the string "
undefined".
... the
undefined value conversion is possible in javascript 1.3 and later versions only.
...And 2 more matches
Index - MDN Web Docs Glossary: Definitions of Web-related terms
281 nan codingscripting, computing, glossary, nan nan (not a number) is a numeric data type that means an
undefined value or value that cannot be represented, especially results of floating-point calculations.
... 293 nullish value glossary, javascript, null, primitive,
undefined in javascript, a nullish value is the value which is either null or
undefined.
...there are 6 primitive data types: string, number, bigint, boolean,
undefined, and symbol.
...And 2 more matches
JSAPI Cookbook
/ note: internal representation, not numeric value bool isnull = v.isnull(); bool isboolean = v.isboolean(); bool isobject = v.isobject(); // note: not broken like typeof === "object" is :-) to set a value use a correspondingly named member mutator function, or assign the result of the correspondingly named standalone function: // javascript var v; v = 0; v = 0.5; v = somestring; v = null; v =
undefined; v = false; /* jsapi */ js::rootedvalue v(cx); js::rootedstring somestring(cx, ...); v.setint32(0); // or: v = js::int32value(0); v.setdouble(0.5); // or: v = js::doublevalue(0.5); v.setstring(somestring); // or: v = js::stringvalue(somestring); v.setnull(); // or: v = js::nullvalue(); v.set
undefined(); // or: v = js::
undefinedvalue(); v.setboolean(false); ...
... in cases where it is certain that y is an object (that is, not a boolean, number, string, null, or
undefined), this is fairly straightforward.
... /* jsapi */ if (!js_defineproperty(cx, obj, "prop", js::
undefinedvalue(), (jspropertyop) getpropfunc, (jsstrictpropertyop) setpropfunc, jsprop_shared | jsprop_native_accessors | jsprop_enumerate)) { return false; } defining a read-only property with only a getter // javascript object.defineproperty(obj, "prop", {get: getpropfunc, enumerable: true}); in the jsapi version, ...
...And 2 more matches
JS::Value
a c++ variable of type js::value represents a value in javascript: a string, number, object (including arrays and functions), boolean, symbol, null, or
undefined.
... the data in a js::value can be accessed using these member functions: js type js::value type tests constructor accessors mutators null val.isnull() js::nullvalue() n/a val.setnull()
undefined val.is
undefined() js::
undefinedvalue() n/a val.set
undefined() boolean val.isboolean(), val.istrue(), val.isfalse() js::booleanvalue(bool), js::truevalue(), js::falsevalue() val.toboolean() val.setboolean(bool) number val.isint32(), val.isdouble(), val.isnumber() js::numbervalue(any number type), js::int32value(int32_t), js::doublevalue(double), js::...
... val.isobjectornull() returns true if the value is either an object or
undefined.
...And 2 more matches
Expressions and operators - JavaScript
examples of expressions that can be converted to false are those that evaluate to null, 0, nan, the empty string (""), or
undefined.
...null or
undefined.
...trying to access it afterwards will yield
undefined.
...And 2 more matches
Meta programming - JavaScript
here, an object that is proxied will not return
undefined when getting
undefined properties, but will instead return the number 42.
... handler.getownpropertydescriptor() object.getownpropertydescriptor() reflect.getownpropertydescriptor() getownpropertydescriptor must return an object or
undefined.
... the value reported for a property must be
undefined if the corresponding target property is non-configurable accessor property that has
undefined as its [[get]] attribute.
...And 2 more matches
TypeError: can't access property "x" of "y" - JavaScript
the javascript exception "can't access property" occurs when property access was operated on
undefined or null values.
... message typeerror: unable to get property {x} of
undefined or null reference (edge) typeerror: can't access property {x} of {y} (firefox) typeerror: {y} is
undefined, can't access property {x} of it (firefox) typeerror: {y} is null, can't access property {x} of it (firefox) examples: typeerror: x is
undefined, can't access property "prop" of it typeerror: x is null, can't access property "prop" of it typeerror: can't access property "prop" of
undefined typeerror: can't access property "prop" of null error type typeerror.
... the property access was operated on
undefined or null value.
...And 2 more matches
Array.prototype.map() - JavaScript
callback is invoked only for indexes of the array which have assigned values (including
undefined).
...otherwise, the value
undefined will be used as its this value.
...if thisarg was supplied, let t be thisarg; else let t be
undefined.
...And 2 more matches
Object.assign() - JavaScript
note: object.assign() does not throw on null or
undefined sources.
... polyfill this polyfill doesn't support symbol properties, since es5 doesn't have symbols anyway: if (typeof object.assign !== 'function') { // must be writable: true, enumerable: false, configurable: true object.defineproperty(object, "assign", { value: function assign(target, varargs) { // .length of function is 2 'use strict'; if (target === null || target ===
undefined) { throw new typeerror('cannot convert
undefined or null to object'); } var to = object(target); for (var index = 1; index < arguments.length; index++) { var nextsource = arguments[index]; if (nextsource !== null && nextsource !==
undefined) { for (var nextkey in nextsource) { // avoid bugs when hasownproperty is shadowed if (ob...
... } }); const copy = object.assign({}, obj); console.log(copy); // { baz: 3 } primitives will be wrapped to objects const v1 = 'abc'; const v2 = true; const v3 = 10; const v4 = symbol('foo'); const obj = object.assign({}, v1, null, v2,
undefined, v3, v4); // primitives will be wrapped, null and
undefined will be ignored.
...And 2 more matches
String.prototype.codePointAt() - JavaScript
if there is no element at pos, returns
undefined.
... description if there is no element at the specified position,
undefined is returned.
...https://mths.be/codepointat v0.2.0 by @mathias */ if (!string.prototype.codepointat) { (function() { 'use strict'; // needed to support `apply`/`call` with `
undefined`/`null` var defineproperty = (function() { // ie 8 only supports `object.defineproperty` on dom elements try { var object = {}; var $defineproperty = object.defineproperty; var result = $defineproperty(object, object, object) && $defineproperty; } catch(error) {} return result; }()); var codepointat = function(position) { if (this == nu...
...And 2 more matches
TypedArray.prototype.find() - JavaScript
otherwise
undefined is returned.
... return value a value in the array if an element passes the test; otherwise,
undefined.
...otherwise, find returns
undefined.
...And 2 more matches
WeakRef - JavaScript
instance methods weakref.prototype.deref() returns the weakref object's target object, or
undefined if the target object has been reclaimed.
...the result of calling deref on one of them will match the result of calling deref on another of them (in the same job), you won't get the target object from one of them but
undefined from another.
... if the target of a weakref is also in a finalizationregistry, the weakref's target is cleared at the same time or before any cleanup callback associated with the registry is called; if your cleanup callback calls deref on a weakref for the object, it will receive
undefined.
...And 2 more matches
Client-side storage - Learn web development
when there are no more records to iterate over, cursor will return
undefined, and therefore the else block will run instead of the if block.
... if each video is found in the database (easily checked by seeing whether request.result evaluates to true — if the record is not present, it will be
undefined), its video files (stored as blobs) and the video name are passed straight to the displayvideo() function to place them in the ui.
... function init() { // loop through the video names one by one for(let i = 0; i < videos.length; i++) { // open transaction, get object store, and get() each video by name let objectstore = db.transaction('videos_os').objectstore('videos_os'); let request = objectstore.get(videos[i].name); request.onsuccess = function() { // if the result exists in the database (is not
undefined) if(request.result) { // grab the videos from idb and display them using displayvideo() console.log('taking videos from idb'); displayvideo(request.result.mp4, request.result.webm, request.result.name); } else { // fetch the videos from the network fetchvideofromnetwork(videos[i]); } }; } } the following snippet is taken from i...
...this promise fulfills with the matching response if a match is not found, or
undefined if it isn't.
TypeScript support in Svelte - Learn web development
const removecompletedtodos = () => { $alert = `removed ${todos.filter(t => t.completed).length} todos` todos = todos.filter(t => !t.completed) } </script> todosstatus.svelte we are encountering the following errors related to passing todos to the todosstatus.svelte (and todo.svelte) components: ./src/components/todos.svelte:70:39 error: type 'todotype[]' is not assignable to type '
undefined'.
... (ts) <todosstatus bind:this={todosstatus} {todos} /> ./src/components/todos.svelte:76:12 error: type 'todotype' is not assignable to type '
undefined'.
... (ts) <todo {todo} this is because the todos prop in the todosstatus component has no default value, so typescript has inferred it to be of type
undefined, which is not compatible with an array of todotype.
...so it is in fact any javascript object with a couple limitations, for example
undefined, functions, and symbols are not valid json values.
Advanced Svelte: Reactivity, lifecycle, accessibility - Learn web development
node if (autofocus) nameel.focus() now go back to the todos component, and pass the autofocus prop into the <newtodo> component call, like so: <!-- newtodo --> <newtodo autofocus on:addtodo={e => addtodo(e.detail)} /> if you try your app out now, you'll see that the page is now blank, and in your devtools web console you'll see an error along the lines of: typeerror: nameel is
undefined.
... the app will now work again, and you'll see the following in your console: initializing:
undefined mounted: <input id="todo-0" class="input input__lg" type="text" autocomplete="off"> as you can see, while the component is initializing nameel is
undefined, which makes sense because the node input doesn't even exist yet.
... // enter editing mode nameel.focus() // set focus to name input } and finally, bind nameel to the <input> field, by updating it like so: <input bind:value={name} bind:this={nameel} type="text" id="todo-{todo.id}" autocomplete="off" class="todo-text" /> however, when you try the updated app you'll get an error along the lines of "typeerror: nameel is
undefined" in the console when you press a todo's edit button.
...in the following example, the first three declarations are props, and the rest are exported values: <script> export let bar = 'optional default initial value' // prop export let baz =
undefined // prop export let format = n => n.tofixed(2) // prop // these are readonly export const thisis = 'readonly' // read-only export export function greet(name) { // read-only export alert(`hello ${name}!`) } export const greet = (name) => alert(`hello ${name}!`) // read-only export </s...
DownloadList
promise resolves to
undefined when the download has been added.
... promise resolves to
undefined when the download has been removed.
... promise resolves to
undefined when the view has been registered and all the ondownloadadded notifications for the existing downloads have been sent.
... promise resolves to
undefined when the view has been removed.
Promise.jsm
this may be any value, including
undefined.
...this may be any value, including
undefined, though it is generally an error object, like in exception handling.
... promise resolve( avalue ); parameters avalue optional if this value is not a promise, including
undefined, it becomes the fulfillment value of the returned promise.
...although the reason can be
undefined, it is generally an error object, like in exception handling.
Tutorial: Embedding Rhino
the javascript feature calledliveconnect allows javascript programs to interact with java objects: $ java runscript "java.lang.system.out.println(3)" 3.0
undefined implementing interfaces using rhino, javascript objects can implement arbitrary java interfaces.
...this is the same as runscript, but with the addition of two extra lines of code: object wrappedout = context.javatojs(system.out, scope); scriptableobject.putproperty(scope, "out", wrappedout); these lines add a global variable out that is a javascript reflection of the system.out variable: $ java runscript2 "out.println(42)" 42.0
undefined using javascript objects from java after evaluating a script it's possible to query the scope for variables and functions, extracting values and calling javascript functions.
...for example, $ java runscript3 "x = 7" x = 7 f is
undefined or not a function.
...following code: object x = scope.get("x", scope); if (x == scriptable.not_found) { system.out.println("x is not defined."); } else { system.out.println("x = " + context.tostring(x)); } calling javascript functions to get the function f, call it, and print the result, we add this code: object fobj = scope.get("f", scope); if (!(fobj instanceof function)) { system.out.println("f is
undefined or not a function."); } else { object functionargs[] = { "my arg" }; function f = (function)fobj; object result = f.call(cx, scope, scope, functionargs); string report = "f('my args') = " + context.tostring(result); system.out.println(report); } javascript host objects defining host objects custom host objects can implement special javascript features like dynamic properti...
JSClass.flags
mxr id search for jsclass_is_domjsclass jsclass_emulates_
undefined added in spidermonkey 24 causes objects which have this class to emulate
undefined in certain circumstances.
... an object obj that emulates
undefined behaves like any other object, except in the following ways: typeof obj === "
undefined" obj converts to false when obj is converted to a boolean when used in boolean contexts (if conditions, loop continuation/termination conditions [for/while/do { } while], the condition in a ternary ?: expression, and so on) (obj ==
undefined) is true, and (obj !=
undefined) is false (obj == null) is true, and (obj != null) is false == and != comparisons to values other than null or
undefined (including to an object that emulates
undefined) are unaffected by this flag.
... mxr id search for jsclass_emulates_
undefined jsclass_has_reserved_slots(n) indicates that instances of this class have n reserved slots.
... see also bug 527805 - removed jsclass_share_all_properties bug 571789 - removed jsclass_is_extended bug 638291 - removed jsclass_mark_is_trace bug 641025 - added jsclass_implements_barriers bug 702507 - removed jsclass_construct_prototype bug 758913 - removed jsclass_new_resolve_gets_start bug 766447 - added jsclass_is_domjsclass bug 792108 - added jsclass_emulates_
undefined bug 993026 - removed jsclass_new_resolve bug 1097267 - removed jsclass_new_enumerate ...
JS_LookupElement
on success, *vp receives the stored value of obj[index], or
undefined if the element does not exist.
...if no such property exists, js_lookupelement sets *vp to
undefined and returns true (to indicate that no error occurred).
... on error or exception, js_lookupelement returns false, and the value left in *vp is
undefined.
... js_lookupelement does not distinguish between a property with a value of
undefined and a property that does not exist.
JS_LookupProperty
if neither obj nor any of its prototypes have such a property, *vp receives
undefined and the return value is true (to indicate no error occurred).
... on error or exception (such as running out of memory during the search), the return value is false, and the value left in *vp is
undefined.
... there is no way to tell the difference between not finding any property and finding a property whose value is
undefined.
... notes js_lookupproperty does not distinguish between a property with a value of
undefined and a property that does not exist.
JSAPI reference
nkey 31 typedef jsexceptionstate js_saveexceptionstate js_restoreexceptionstate js_dropexceptionstate these functions translate errors into exceptions and vice versa: js_reportpendingexception js_errorfromexception js_throwreportederror obsolete since jsapi 29 values and types typedef jsval js::value js::value constructors: js::nullvalue added in spidermonkey 24 js::
undefinedvalue added in spidermonkey 24 js::booleanvalue added in spidermonkey 24 js::truevalue added in spidermonkey 24 js::falsevalue added in spidermonkey 24 js::numbervalue added in spidermonkey 24 js::int32value added in spidermonkey 24 js::doublevalue added in spidermonkey 24 js::float32value added in spidermonkey 24 js::stringvalue added in spidermonkey 24 js::objectvalue added in spidermon...
...key 24 js::objectornullvalue added in spidermonkey 24 js::symbolvalue added in spidermonkey 38 js::value constants: js::nullhandlevalue added in spidermonkey 24 js::
undefinedhandlevalue added in spidermonkey 24 js::truehandlevalue added in spidermonkey 38 js::falsehandlevalue added in spidermonkey 38 jsval constants: jsval_null obsolete since jsapi 42 jsval_void obsolete since jsapi 42 jsval_true obsolete since jsapi 42 jsval_false obsolete since jsapi 42 jsval_zero obsolete since jsapi 42 jsval_one obsolete since jsapi 42 function and macros for checking the type of a jsval: enum jstype js_typeofvalue all of the following are deprecated.
...forwardgetpropertyto added in spidermonkey 17 js_forwardgetelementto added in spidermonkey 17 js_getpropertydescriptor added in spidermonkey 31 js_getpropertydescriptorbyid added in spidermonkey 1.8.1 js_getownpropertydescriptor added in spidermonkey 31 js_getownpropertydescriptorbyid added in spidermonkey 31 js_getownucpropertydescriptor added in spidermonkey 45 js_setallnonreservedslotsto
undefined added in spidermonkey 24 js_aliasproperty obsolete since jsapi 8 js_clearscope obsolete since jsapi 18 js_clearnonglobalobject added in spidermonkey 18 obsolete since jsapi 34 js_defineownproperty added in spidermonkey 1.8.5 obsolete since jsapi 33 js_definepropertywithtinyid obsolete since jsapi 30 js_defineucpropertywithtinyid obsolete since jsapi 30 js_getpropertydefault obsolete sin...
... in spidermonkey 31 js_ps_end added in spidermonkey 17 jsfastnative added in spidermonkey 1.8 obsolete since javascript 1.8.5 the behavior of a jsclass can be customized using these flags: jsclass.flags jsclass_has_private jsclass_private_is_nsisupports jsclass_is_domjsclass added in spidermonkey 17 jsclass_implements_barriers added in spidermonkey 17 jsclass_emulates_
undefined added in spidermonkey 24 jsclass_has_reserved_slots(n) jsclass_global_flags jsclass_new_enumerate obsolete since jsapi 37 jsclass_new_resolve obsolete since jsapi 36 jsclass_share_all_properties obsolete since javascript 1.8.5 jsclass_new_resolve_gets_start obsolete since jsapi 16 jsclass_construct_prototype obsolete since jsapi 11 jsclass_is_extended obsolete since jsapi ...
WebIDL bindings
the first of these methods allows the caller to pass in a this object, while the second defaults to
undefined as the this value.
...the first call method has the same signature as a throwing method declared just like the callback function, with an additional trailing "mozilla::dom::callbackobject::exceptionhandling aexceptionhandling" argument, defaulting to ereportexceptions, and calling it will invoke the callable with
undefined as the this value.
...the value that the property should have is returned in the mutablehandle<value>, with
undefinedvalue() indicating that the property does not exist.
... checking for permissions or preferences with js-implemented webidl, the init method should only return
undefined.
EventTarget.addEventListener() - Web APIs
return value
undefined usage notes the event listener callback the event listener can be specified as either a callback function or an object that implements eventlistener, whose handleevent() method serves as the callback function.
...</table> the value of this within logid() is a reference to the global object window (or
undefined in the case of strict mode.
... this is an example with and without bind(): const something = function(element) { // |this| is a newly created object this.name = 'something good'; this.onclick1 = function(event) { console.log(this.name); //
undefined, as |this| is the element }; this.onclick2 = function(event) { console.log(this.name); // 'something good', as |this| is bound to newly created object }; element.addeventlistener('click', this.onclick1, false); element.addeventlistener('click', this.onclick2.bind(this), false); // trick } const s = new something(document.body); another solution is using a special function called h...
...t.prototype.stoppropagation=function() { this.cancelbubble=true; }; } if (!element.prototype.addeventlistener) { var eventlisteners=[]; var addeventlistener=function(type,listener /*, usecapture (will be ignored) */) { var self=this; var wrapper=function(e) { e.target=e.srcelement; e.currenttarget=self; if (typeof listener.handleevent != '
undefined') { listener.handleevent(e); } else { listener.call(self,e); } }; if (type=="domcontentloaded") { var wrapper2=function(e) { if (document.readystate=="complete") { wrapper(e); } }; document.attachevent("onreadystatechange",wrapper2); eventlisteners.push({object:this,type:type,listener:l...
Using the Resource Timing API - Web APIs
function calculate_load_times() { // check performance support if (performance ===
undefined) { console.log("= calculate load times: performance not supported"); return; } // get a list of "resource" performance entries var resources = performance.getentriesbytype("resource"); if (resources ===
undefined || resources.length <= 0) { console.log("= calculate load times: there are no `resource` performance records"); return; } console.log("= calculate load time...
... if (performance ===
undefined) { console.log("= display size data: performance not supported"); return; } var list = performance.getentriesbytype("resource"); if (list ===
undefined) { console.log("= display size data: performance.getentriesbytype() is not supported"); return; } // for each "resource", display its *size property values console.log("= display size data"); for (var i=0; i < list...
... function clear_resource_timings() { if (performance ===
undefined) { console.log("= performance.clearresourcetimings(): peformance not supported"); return; } // check if performance.clearresourcetiming() is supported console.log ("= print performance.clearresourcetimings()"); var supported = typeof performance.clearresourcetimings == "function"; if (supported) { console.log("...
...performance data buffer not cleared (still have `" + p.length + "` items"); } function set_resource_timing_buffer_size(n) { if (performance ===
undefined) { console.log("= performance.setresourcetimingbuffersize(): peformance not supported"); return; } // check if performance.setresourcetimingbuffersize() is supported console.log ("= performance.setresourcetimingbuffersize()"); var supported = typeof performance.setresourcetimingbuffersize == "function"; if (supported) { console.log("...
TextEncoder - Web APIs
if (typeof textencoder === "
undefined") { textencoder=function textencoder(){}; textencoder.prototype.encode = function encode(str) { "use strict"; var len = str.length, respos = -1; // the uint8array's length must be at least 3x the length of the string because an invalid utf-16 // takes up the equivelent space of 3 utf-8 characters to encode it properly.
... var resarr = typeof uint8array === "
undefined" ?
...r[respos += 1] = (0x2/*0b10*/<<6) | (point&0x3f/*0b00111111*/); } else { resarr[respos += 1] = (0xe/*0b1110*/<<4) | (point>>>12); resarr[respos += 1] = (0x2/*0b10*/<<6) | ((point>>>6)&0x3f/*0b00111111*/); resarr[respos += 1] = (0x2/*0b10*/<<6) | (point&0x3f/*0b00111111*/); } } if (typeof uint8array !== "
undefined") return resarr.subarray(0, respos + 1); // else // ie 6-9 resarr.length = respos + 1; // trim off extra weight return resarr; }; textencoder.prototype.tostring = function(){return "[object textencoder]"}; try { // object.defineproperty only works on dom prototypes in ie8 object.defineproperty(textencoder.prototype,"encoding",{ get:function(...
...){if(textencoder.prototype.isprototypeof(this)) return"utf-8"; else throw typeerror("illegal invocation");} }); } catch(e) { /*ie6-8 fallback*/ textencoder.prototype.encoding = "utf-8"; } if(typeof symbol!=="
undefined")textencoder.prototype[symbol.tostringtag]="textencoder"; } source: https://github.com/anonyco/fastestsmallesttextencoderdecoder specifications specification status comment encodingthe definition of 'textencoder' in that specification.
ARIA: button role - Accessibility
if the attribute is omitted or set to its default value of aria-pressed="
undefined", the element does not support being pressed.
... if the button has aria-expanded="false" set, the grouping is not currently expanded; if the button has aria-expanded="true" set, it is currently expanded; if the button has aria-expanded="
undefined" set or the attribute is ommitted, it is not expandable.
... whether an element is a toggle button or not can be indicated with the aria-pressed attribute in addition to the button role (if the element is not already a native button element): if aria-pressed is not used, or is set to the "
undefined" state, the button is not a toggle button.
...this attribute has one of four possible values: true, false, mixed,
undefined examples basic button example in this example, a span element has been given the button role.
Public class fields - JavaScript
class classwithstaticfield { static staticfield = 'static field' } console.log(classwithstaticfield.staticfield) // expected output: "static field" fields without initializers are initialized to
undefined.
... class classwithstaticfield { static staticfield } console.assert(classwithstaticfield.hasownproperty('staticfield')) console.log(classwithstaticfield.staticfield) // expected output: "
undefined" public static fields are not reinitialized on subclasses, but can be accessed via the prototype chain.
... class classwithinstancefield { instancefield = 'instance field' } const instance = new classwithinstancefield() console.log(instance.instancefield) // expected output: "instance field" fields without initializers are initialized to
undefined.
... class classwithinstancefield { instancefield } const instance = new classwithinstancefield() console.assert(instance.hasownproperty('instancefield')) console.log(instance.instancefield) // expected output: "
undefined" like properties, field names may be computed.
TypeError: "x" has no properties - JavaScript
the javascript exception "null (or
undefined) has no properties" occurs when you attempt to access properties of null and
undefined.
... message typeerror: unable to get property {x} of
undefined or null reference (edge) typeerror: null has no properties (firefox) typeerror:
undefined has no properties (firefox) error type typeerror.
... both, null and
undefined, have no properties you could access.
... examples null and
undefined have no properties null.foo; // typeerror: null has no properties
undefined.bar; // typeerror:
undefined has no properties ...
Array.prototype.sort() - JavaScript
description if comparefunction is not supplied, all non-
undefined array elements are sorted by converting them to strings and comparing strings in utf-16 code units order.
...all
undefined elements are sorted to the end of the array.
... if comparefunction is supplied, all non-
undefined array elements are sorted according to the return value of the compare function (all
undefined elements are sorted to the end of the array, with no call to comparefunction).
...if inconsistent results are returned, then the sort order is
undefined.
Map.prototype.forEach() - JavaScript
return value
undefined.
...however, it is executed for values which are present but have the value
undefined.
... otherwise, the value
undefined will be passed for use as its this value.
... examples printing the contents of a map object the following code logs a line for each element in an map object: function logmapelements(value, key, map) { console.log(`map.get('${key}') = ${value}`) } new map([['foo', 3], ['bar', {}], ['baz',
undefined]]).foreach(logmapelements) // logs: // "map.get('foo') = 3" // "map.get('bar') = [object object]" // "map.get('baz') =
undefined" specifications specification ecmascript (ecma-262)the definition of 'map.prototype.foreach' in that specification.
Object.create() - JavaScript
propertiesobject optional if specified and not
undefined, an object whose enumerable own properties (that is, those properties defined upon itself and not enumerable properties along its prototype chain) specify property descriptors to be added to the newly-created object, with the corresponding property names.
...ostring() // shows [object object] > ocn.tostring() // throws error: ocn.tostring is not a function > oco.valueof() // shows {} > ocn.valueof() // throws error: ocn.valueof is not a function > oco.hasownproperty("p") // shows "true" > ocn.hasownproperty("p") // throws error: ocn.hasownproperty is not a function > oco.constructor // shows "object() { [native code] }" > ocn.constructor // shows "
undefined" as said, these differences can make debugging even simple-seeming problems quickly go astray.
... function adding the missing object-method directly to new object's "prototype" does not work either, since the new object does not have a real prototype (which is really the cause of all these problems) and one cannot be directly added: ocn = object.create( null ); // create "null" object (same as before) ocn.prototype.tostring = object.tostring; // error: cannot set property 'tostring' of
undefined ocn.prototype = {}; // try to create a prototype ocn.prototype.tostring = object.tostring; // since new object lacks method then try assigning it from standard-object > ocn.tostring() // error: ocn.tostring is not a function adding the missing object-method by using the standard-object as new object's prototype does not work either: ocn = object.create( null ); ...
...ertiesobject) { if (typeof proto !== 'object' && typeof proto !== 'function') { throw new typeerror('object prototype may only be an object: ' + proto); } else if (proto === null) { throw new error("this browser's implementation of object.create is a shim and doesn't support 'null' as the first argument."); } if (typeof propertiesobject != '
undefined') { throw new error("this browser's implementation of object.create is a shim and doesn't support a second argument."); } function f() {} f.prototype = proto; return new f(); }; } examples classical inheritance with object.create() below is an example of how to use object.create() to achieve classical inheritance.
Object.getOwnPropertyDescriptor() - JavaScript
return value a property descriptor of the given property if it exists on the object,
undefined otherwise.
... get a function which serves as a getter for the property, or
undefined if there is no getter (accessor descriptors only).
... set a function which serves as a setter for the property, or
undefined if there is no setter (accessor descriptors only).
... examples using object.getownpropertydescriptor var o, d; o = { get foo() { return 17; } }; d = object.getownpropertydescriptor(o, 'foo'); // d is { // configurable: true, // enumerable: true, // get: /*the getter function*/, // set:
undefined // } o = { bar: 42 }; d = object.getownpropertydescriptor(o, 'bar'); // d is { // configurable: true, // enumerable: true, // value: 42, // writable: true // } o = { [symbol.for('baz')]: 73 } d = object.getownpropertydescriptor(o, symbol.for('baz')); // d is { // configurable: true, // enumerable: true, // value: 73, // writable: true // } o = {}; object.defineproperty(o, 'qux'...
Promise.prototype.catch() - JavaScript
it behaves the same as calling promise.prototype.then(
undefined, onrejected) (in fact, calling obj.catch(onrejected) internally calls obj.then(
undefined, onrejected)).
... this means that you have to provide an onrejected function even if you want to fall back to an
undefined result value - for example obj.catch(() => {}).
... return value internally calls promise.prototype.then on the object upon which it was called, passing the parameters
undefined and the received onrejected handler.
....catch on %o with arguments: %o', this, arguments); return originalcatch.apply(this, arguments); }; })(this.promise); // calling catch on an already resolved promise promise.resolve().catch(function xxx(){}); // logs: // > > > > > > called .catch on promise{} with arguments: arguments{1} [0: function xxx()] // > > > > > > called .then on promise{} with arguments: arguments{2} [0:
undefined, 1: function xxx()] description the catch method is used for error handling in promise composition.
Promise.prototype.then() - JavaScript
doesn't return anything, the promise returned by then gets resolved with an
undefined value.
...the value received and returned is: " + value); return value; }); // instantly logging the value of thenprom console.log(thenprom); // using settimeout we can postpone the execution of a function to the moment the stack is empty settimeout(() => { console.log(thenprom); }); // logs, in order: // promise {[[promisestatus]]: "pending", [[promisevalue]]:
undefined} // "this gets called after the end of the main stack.
... const nexttick = (() => { const noop = () => {}; // literally const nexttickpromise = () => promise.resolve().then(noop); const rfab = reflect.apply.bind; // (thisarg, fn, thisarg, [...args]) const nexttick = (fn, ...args) => ( fn !==
undefined ?
... promise.resolve(args).then(rfab(null, fn, null)) : nexttickpromise(),
undefined ); nexttick.ntp = nexttickpromise; return nexttick; })(); specifications specification ecmascript (ecma-262)the definition of 'promise.prototype.then' in that specification.
Proxy - JavaScript
obj[prop] : 37; } }; const p = new proxy({}, handler); p.a = 1; p.b =
undefined; console.log(p.a, p.b); // 1,
undefined console.log('c' in p, p.c); // false, 37 no-op forwarding proxy in this example, we are using a native javascript object to which our proxy will forward all operations that are applied to it.
...pes[product.type]) { types[product.type].push(product); } else { types[product.type] = [product]; } } // get a product by name if (result) { return result; } // get products by type if (prop in types) { return types[prop]; } // get product types if (prop === 'types') { return object.keys(types); } return
undefined; } }); console.log(products[0]); // { name: 'firefox', type: 'browser' } console.log(products['firefox']); // { name: 'firefox', type: 'browser' } console.log(products['chrome']); //
undefined console.log(products.browser); // [{ name: 'firefox', type: 'browser' }, { name: 'seamonkey', type: 'browser' }] console.log(products.types); // ['browser', 'mailer'] console.log(pr...
...get the "doccookies" object here: https://developer.mozilla.org/docs/dom/document.cookie#a_little_framework.3a_a_complete_cookies_reader.2fwriter_with_full_unicode_support */ var doccookies = new proxy(doccookies, { get: function (otarget, skey) { return otarget[skey] || otarget.getitem(skey) ||
undefined; }, set: function (otarget, skey, vvalue) { if (skey in otarget) { return false; } return otarget.setitem(skey, vvalue); }, deleteproperty: function (otarget, skey) { if (skey in otarget) { return false; } return otarget.removeitem(skey); }, enumerate: function (otarget, skey) { return otarget.keys(); }, ownkeys: function (otarget, skey) { return otarget.ke...
...{ value: vvalue, writable: true, enumerable: true, configurable: false } :
undefined; }, }); /* cookies test */ console.log(doccookies.my_cookie1 = 'first value'); console.log(doccookies.getitem('my_cookie1')); doccookies.setitem('my_cookie1', 'changed value'); console.log(doccookies.my_cookie1); specifications specification ecmascript (ecma-262)the definition of 'proxy' in that specification.
Reflect.getOwnPropertyDescriptor() - JavaScript
it returns a property descriptor of the given property if it exists on the object,
undefined otherwise.
... return value a property descriptor object if the property exists in target object; otherwise,
undefined.
... description the reflect.getownpropertydescriptor method returns a property descriptor of the given property if it exists in the target object,
undefined otherwise.
... examples using reflect.getownpropertydescriptor() reflect.getownpropertydescriptor({x: 'hello'}, 'x') // {value: "hello", writable: true, enumerable: true, configurable: true} reflect.getownpropertydescriptor({x: 'hello'}, 'y') //
undefined reflect.getownpropertydescriptor([], 'length') // {value: 0, writable: true, enumerable: false, configurable: false} difference to object.getownpropertydescriptor() if the target argument to this method is not an object (a primitive), then it will cause a typeerror.
Set.prototype.forEach() - JavaScript
return value
undefined.
...however, it is executed for values which are present but have the value
undefined.
... otherwise, the value
undefined will be passed for use as its this value.
... examples logging the contents of a set object the following code logs a line for each element in a set object: function logsetelements(value1, value2, set) { console.log('s[' + value1 + '] = ' + value2); } new set(['foo', 'bar',
undefined]).foreach(logsetelements); // logs: // "s[foo] = foo" // "s[bar] = bar" // "s[
undefined] =
undefined" specifications specification ecmascript (ecma-262)the definition of 'set.prototype.foreach' in that specification.
TypedArray.prototype.forEach() - JavaScript
return value
undefined.
...however, it is executed for elements that are present and have the value
undefined.
... otherwise, the value
undefined will be passed for use as its this value.
... foreach() executes the callback function once for each typed array element; unlike every() and some() it, always returns the value
undefined.
delete operator - JavaScript
in explorer, while the property value is indeed set to
undefined, if one later adds back a property with the same name, the property will be iterated in its old position--not at the end of the iteration sequence as one might expect after having deleted the property and then added it back.
...console.log(foo.bar); //
undefined deleting array elements when you delete an array element, the array length is not affected.
... var trees = ['redwood', 'bay', 'cedar', 'oak', 'maple']; delete trees[3]; if (3 in trees) { // this is not executed } if you want an array element to exist but have an
undefined value, use the
undefined value instead of the delete operator.
... in the following example, trees[3] is assigned the value
undefined, but the array element still exists: var trees = ['redwood', 'bay', 'cedar', 'oak', 'maple']; trees[3] =
undefined; if (3 in trees) { // this is executed } if instead, you want to remove an array element by changing the contents of the array, use the splice() method.
let - JavaScript
for example: var x = 'global'; let y = 'global'; console.log(this.x); // "global" console.log(this.y); //
undefined emulating private members in dealing with constructors it is possible to use the let bindings to share one or more private members without using closures: var thing; { let privatescope = new weakmap(); let counter = 0; thing = function() { this.someproperty = 'foo'; privatescope.set(this, { hidden: ++counter, }); }; thing.prototype.showpublic = function() { ...
... return this.someproperty; }; thing.prototype.showprivate = function() { return privatescope.get(this).hidden; }; } console.log(typeof privatescope); // "
undefined" var thing = new thing(); console.log(thing); // thing {someproperty: "foo"} thing.showpublic(); // "foo" thing.showprivate(); // 1 the same privacy pattern with closures over local variables can be created with var, but those need a function scope (typically an iife in the module pattern) instead of just a block scope like in the example above.
... let x = 1; switch(x) { case 0: { let foo; break; } case 1: { let foo; break; } } temporal dead zone unlike variables declared with var, which will start with the value
undefined, let variables are not initialized until their definition is evaluated.
... function do_something() { console.log(bar); //
undefined console.log(foo); // referenceerror var bar = 1; let foo = 2; } the temporal dead zone and typeof unlike with simply undeclared variables and variables that hold a value of
undefined, using the typeof operator to check for the type of a variable in that variable's temporal dead zone will throw a referenceerror: // prints out '
undefined' console.log(typeof undeclaredvariable); // results in a 'referenceerror' console.log(typeof i); let i = 10; another example of temporal dead zone combined with lexical scoping due to lexical scoping, the identi...
Hoisting - MDN Web Docs Glossary: Definitions of Web-related terms
if a variable is declared and initialized after using it, the value will be
undefined.
... for example: console.log(num); // returns
undefined, as only declaration was hoisted, no initialization has happened at this stage var num; // declaration num = 6; // initialization the example below only has initialization.
...console.log(x + " " + y); // '1
undefined' // this prints value of y as
undefined as javascript only hoists declarations var y = 2; // declare and initialize y // example 2 // no hoisting, but since initialization also causes declaration (if not already declared), variables are available.
Handling common JavaScript problems - Learn web development
if you look at the console, you'll see the error message "uncaught typeerror: can't access property "length", heroes is
undefined", and the referenced line number is 49.
... expand the showheroes scope — you can see from this that the heroes variable is
undefined, indicating that accessing the members property of jsonobj (first line of the function) didn't work.
...paragraph.style.transform !==
undefined).
Building SpiderMonkey with UBSan
/bin/sh if [ -z $1 ] ; then echo "usage: $0 <dirname>" elif [ -d $1 ] ; then echo "directory $1 already exists" else autoconf2.13 autoconf213 mkdir $1 cd $1 llvm_root="$home/llvm" sanflag="-fsanitize=
undefined -fno-sanitize=alignment,float-cast-overflow,float-divide-by-zero,vptr -dxmalloc=myxmalloc" \ cc="$llvm_root/build/release+asserts/bin/clang" \ cxx="$llvm_root/build/release+asserts/bin/clang++" \ cflags="$sanflag" \ cxxflags="$sanflag" \ moz_llvm_hacks=1 \ ../configure --enable-debug --disable-optimize make -j 8 fi 3.
...this enables all the cheap
undefined behavior checks other than: alignment, which hits known bugs in spidermonkey, and is more implementation-defined (slow on x86 / crash on arm) than
undefined behavior float-cast-overflow, which hits known bugs in spidermonkey, and isn't exploited by today's compilers float-divide-by-zero, which jesse doesn't think is actually
undefined behavior (aside from the question of whether cpu overflow flags are set) vptr, a check that requires rtti, which is disabled by default in spidermonkey 4.
... (for automated testing outside of gdb, you can instead build with -fsanitize=
undefined-trap -fsanitize-
undefined-trap-on-error, but then you lose ubsan's diagnostics and the ability to continue past errors.) known bugs.
DownloadSummary
promise resolves to
undefined when the view on the underlying list has been registered.
... promise resolves to
undefined when the view has been registered and the onsummarychanged notification has been sent.
... promise resolves to
undefined when the view has been removed.
JNI.jsm
return value this function has no return value, if you try to store the return value in a variable, it will be
undefined.
... return value this function has no return value, if you try to store the return value in a variable, it will be
undefined.
... return value this function has no return value, if you try to store the return value in a variable, it will be
undefined.
OS.File for the main thread
this example also shows the resolve value of open (an instance of os.file, this is a file, so you can do any of the methods on it found here), write (a number indicating bytes written), and close (
undefined, meaning there is no resolve value).
... promise<
undefined> unixsymlink( in string pathtarget, in string pathcreate ) arguments pathtarget the complete path to the file that should be launced by the symbolic link.
... promise resolves to
undefined promise can be rejected with os.file.error in case of any error.
Deferred
void resolve( avalue ); parameters avalue optional if this value is not a promise, including
undefined, it becomes the fulfillment value of the associated promise.
...although the reason can be
undefined, it is generally an error object, like in exception handling.
... function deferred() { // update 062115 for typeof if (typeof(promise) != '
undefined' && promise.defer) { //need import of promise.jsm for example: cu.import('resource:/gree/modules/promise.jsm'); return promise.defer(); } else if (typeof(promiseutils) != '
undefined' && promiseutils.defer) { //need import of promiseutils.jsm for example: cu.import('resource:/gree/modules/promiseutils.jsm'); return promiseutils.defer(); } else { /* a method to resolve the associated p...
Examples
when the callback finishes execution, newpromise will be fulfilled with an
undefined fulfillment value, because the callback does not return any value.
...in the example below we try alerting an
undefined variable.
...jsm"); var mypromise = myuserdefinedpromise(); mypromise.then( function(asuccessreason) { alert('mypromise was succesful and reason was = "' + asuccessreason + '"'); }, function(arejectreason) { alert('mypromise failed for reason = "' + uneval(arejectreason) + '"'); } ); function myuserdefinedpromise() { try { //var myvariscommented = 'hi'; // i commented this out s oit is
undefined, this will cause rejected alert(myvariscommented); return promise.resolve('yay success'); // this makes the success function trigger with asuccessreason being 'yay success' but because i commented out the var 2 lines above, it will error out on the alert(myvariscommented) and never get to this success line.
JS_ConvertValue
the result is
undefined value.
... converting to jstype_object works exactly like js::toobject if v.isnullor
undefined() is false, otherwise the result is nullptr.
...on error or exception, it returns false, and the value left in *vp is
undefined.
JS_ForwardGetPropertyTo
on success, *vp receives the current value of the property, or
undefined if no such property is found.
... on success, these functions set *vp to the current value of the property, or
undefined if obj has no such property, and return true.
... on an error or exception, these functions return false, and the value left in *vp is
undefined.
JS_GetElement
on success, *vp receives the current value of the element, if it exists, and
undefined otherwise.
...if not, it sets *vp to
undefined and returns true (to indicate no error occurred).
... if the search fails with an error or exception, js_getelement returns false, and the value left in *vp is
undefined.
nsIContentPrefService2
if the preference is known not to exist, the value attribute of the returned object will be
undefined (nsidatatype.vtype_void()).
...if a preference for a particular subdomain is known not to exist, then an object corresponding to that preference will be present in the array, and, as with getcachedbydomainandname(), its value attribute will be
undefined.
...as with getcachedbydomainandname(), if the preference is cached then it is returned; if the preference is known not to exist, then the value attribute of the returned object will be
undefined; if the preference is neither cached nor known not to exist, then null is returned.
nsIHttpServer
ould happen, or -1 if no specific port is * desired * @throws ns_error_already_initialized * if this server is already started * @throws ns_error_not_available * if the server is not started and cannot be started on the desired port * (perhaps because the port is already in use or because the process does * not have privileges to do so) * @note * behavior is
undefined if this method is called after stop() has been * called on this but before the provided callback function has been * called.
... * @note * if the error handler handles http 500 and throws, behavior is
undefined.
... behavior when not given a string matching * the media-type production in rfc 2616 section 3.7 is
undefined.
Working with data
note: if type.size is
undefined, creating a new object this way will throw a typeerror exception.
... creating initialized cdata objects similarly, you can initialize cdata objects with specific values at the type of creation by specifying them as a parameter when calling the ctype's constructor, like this: var mycdataobj = new type(value); var mycdataobj = type(value); if the size of the specified type isn't
undefined, the specified value is converted to the given type.
...if the size of the new type is
undefined or larger than the size of the original object's data block, typeerror is thrown.
ArrayType
exceptions thrown typeerror type is not a ctype, or type.size is
undefined.if the length is specifed but if it is not a valid one,then it is also thrown rangeerror the size of the resulting array can't be represented as both a size_t and as a javascript number.
... length number the number of elements in the array, or
undefined if the array type doesn't have a specified length.
... note: ctypes.void_t.size is
undefined.
CacheStorage.match() - Web APIs
this method returns a promise for a response, or a promise which resolves to
undefined if no match is found.
...if no matching response to the specified request is found, the promise resolves with
undefined.
... self.addeventlistener('fetch', function(event) { event.respondwith(caches.match(event.request).then(function(response) { // caches.match() always resolves // but in case of success response will have value if (response !==
undefined) { return response; } else { return fetch(event.request).then(function (response) { // response may be used only once // we need to save clone to put one copy in cache // and serve second one let responseclone = response.clone(); caches.open('v1').then(function (cache) { cache.put(event.request, responseclone); }); ...
ReadableStream.getReader() - Web APIs
undefined (or not specified at all — this is the default), which results in a readablestreamdefaultreader being created that can read individual chunks from a stream.
... exceptions rangeerror the provided mode value is not "byob" or
undefined.
...always
undefined when done is true.
Using readable streams - Web APIs
if the stream becomes closed, the promise will be fulfilled with an object of the form { value:
undefined, done: true }.
...if so, there are no more chunks to read (the value is
undefined) so we return out of the function and close the custom stream with readablestreamdefaultcontroller.close(): if (done) { controller.close(); return; } note: close() is part of the new custom stream, not the original stream we are discussing here.
...always
undefined when done is true.
Border-radius generator - CSS: Cascading Style Sheets
.textcontent = name; node.appendchild(info); } node.appendchild(slider_left); node.appendchild(input); node.appendchild(slider_right); node.classname = 'ui-input-slider ui-input-slider-container'; this.input = input; sliders[topic] = this; setvalue(topic, value); } var setvalue = function setvalue(topic, value, send_notify) { var slider = sliders[topic]; if (slider ===
undefined) return; if (value > slider.max) value = slider.max; if (value < slider.min) value = slider.min; slider.value = value; slider.node.setattribute('data-value', value); if (send_notify !==
undefined && send_notify === false) { slider.input.value = value + slider.unit; return; } notify.call(slider); } var setmax = function setmax(topic, value) { var slider = sliders[to...
...pic]; if (slider ===
undefined) return; slider.max = value; setvalue(topic, slider.value); } var setmin = function setmin(topic, value) { var slider = sliders[topic]; if (slider ===
undefined) return; slider.min = value; setvalue(topic, slider.value); } var setunit = function setunit(topic, unit) { var slider = sliders[topic]; if (slider ===
undefined) return; slider.unit = unit; setvalue(topic, slider.value); } var getnode = function getnode(topic) { return sliders[topic].node; } var subscribe = function subscribe(topic, callback) { if (subscribers[topic] ===
undefined) subscribers[topic] = []; subscribers[topic].push(callback); } var unsubscribe = function unsubscribe(topic, callback) { subscribers[topic].indexof(callback); subscriber...
...', function(e) { notify.call(this); }.bind(this)); buttons[topic] = this; } var getnode = function getnode(topic) { return buttons[topic].node; } var setvalue = function setvalue(topic, value) { try { buttons[topic].checkbox.checked = value; } catch(error) { console.log(error); } } var subscribe = function subscribe(topic, callback) { if (subscribers[topic] ===
undefined) subscribers[topic] = []; subscribers[topic].push(callback); } var unsubscribe = function unsubscribe(topic, callback) { subscribers[topic].indexof(callback); subscribers[topic].splice(index, 1); } var notify = function notify() { for (var i = 0; i < subscribers[this.topic].length; i++) subscribers[this.topic][i](this.checkbox.checked); } var init = function init() { var...
max-width - CSS: Cascading Style Sheets
refox for androidopera for androidsafari on iossamsung internetmax-widthchrome full support 1edge full support 12firefox full support 1notes full support 1notes notes css 2.1 leaves the behavior of max-width with table
undefined.
... firefox supports applying max-width to table elements.ie full support 7opera full support 4notes full support 4notes notes css 2.1 leaves the behavior of max-width with table
undefined.
...full support 1webview android full support 4.4chrome android full support 18firefox android full support 4notes full support 4notes notes css 2.1 leaves the behavior of max-width with table
undefined.
min-width - CSS: Cascading Style Sheets
refox for androidopera for androidsafari on iossamsung internetmin-widthchrome full support 1edge full support 12firefox full support 1notes full support 1notes notes css 2.1 leaves the behavior of min-width with table
undefined.
... firefox supports applying min-width to table elements.ie full support 7opera full support 4notes full support 4notes notes css 2.1 leaves the behavior of min-width with table
undefined.
...full support 1webview android full support 4.4chrome android full support 18firefox android full support 4notes full support 4notes notes css 2.1 leaves the behavior of min-width with table
undefined.
Standard metadata names - HTML: Hypertext Markup Language
it must be greater or equal to the minimum-scale or the behaviour is
undefined.
...it must be smaller or equal to the maximum-scale or the behaviour is
undefined.
...in these cases the robot's behaviour is
undefined and may vary between them.
Indexed collections - JavaScript
note that the elements of an array that are omitted when the array is defined are not listed when iterating by foreach, but are listed when
undefined has been manually assigned to the element: let array = ['first', 'second', , 'fourth'] array.foreach(function(element) { console.log(element) }) // first // second // fourth if (array[2] ===
undefined) { console.log('array[2] is
undefined') // true } array = ['first', 'second',
undefined, 'fourth'] array.foreach(function(element) { console.log(element) }) // first // second // undefin...
...if not provided, as with other cases where a function is invoked outside of an explicit object context, this will refer to the global object (window) when using arrow function as callback, or
undefined when using normal function as callback.
... let a = ['a', 'b', 'c', 'd', 'a', 'b'] console.log(a.lastindexof('b')) // logs 5 // now try again, starting from before the last match console.log(a.lastindexof('b', 4)) // logs 1 console.log(a.lastindexof('z')) // logs -1 foreach(callback[, thisobject]) executes callback on every array item and returns
undefined.
Warning: JavaScript 1.6's for-each-in loops are deprecated - JavaScript
var array = [10, 20, 30]; for (var x of array) { console.log(x); // 10 // 20 // 30 } iterating over a null-able array for each...in does nothing if the specified value is null or
undefined, but for...of will throw an exception in these cases.
... deprecated syntax function func(array) { for each (var x in array) { console.log(x); } } func([10, 20]); // 10 // 20 func(null); // prints nothing func(
undefined); // prints nothing alternative standard syntax to rewrite for each...in statements so that values can be null or
undefined with for...of as well, you need to guard around for...of.
... function func(array) { if (array) { for (var x of array) { console.log(x); } } } func([10, 20]); // 10 // 20 func(null); // prints nothing func(
undefined); // prints nothing iterating over an object's key-value pair deprecated syntax there's a deprecated idiom to iterate over the specified object's key-value pairs using for each...in and the deprecated iterator object.
Functions - JavaScript
for all other functions, the default return value is
undefined.
... function parameters default parameters default function parameters allow formal parameters to be initialized with default values if no value or
undefined is passed.
...attempting to use it outside the function's body results in an error (or
undefined if the function name was previously declared via a var statement).
Array.prototype.every() - JavaScript
otherwise, the value
undefined will be used as its this value.
...if thisarg was supplied, let t be thisarg; else let t be
undefined.
...let testresult be the result of calling the call internal method // of callbackfn with t as the this value if t is not
undefined // else is the result of calling callbackfn // and argument list containing kvalue, k, and o.
Array.prototype.filter() - JavaScript
otherwise, the value
undefined will be used as its this value.
...((typeof func === 'function' || typeof func === 'function') && this) ) throw new typeerror(); var len = this.length >>> 0, res = new array(len), // preallocate array t = this, c = 0, i = -1; var kvalue; if (thisarg ===
undefined){ while (++i !== len){ // checks to see if the key was set if (i in this){ kvalue = t[i]; // in case t is changed in callback if (func(t[i], i, t)){ res[c++] = kvalue; } } } } else{ while (++i !== len){ // checks to see if the key was set if (i in this){ kvalue = t[i]; i...
... let arr = [ { id: 15 }, { id: -1 }, { id: 0 }, { id: 3 }, { id: 12.2 }, { }, { id: null }, { id: nan }, { id: '
undefined' } ] let invalidentries = 0 function filterbyid(item) { if (number.isfinite(item.id) && item.id !== 0) { return true } invalidentries++ return false; } let arrbyid = arr.filter(filterbyid) console.log('filtered array\n', arrbyid) // filtered array // [{ id: 15 }, { id: -1 }, { id: 3 }, { id: 12.2 }] console.log('number of invalid entries = ', invalidentries) // number of invalid ...
Array.prototype.shift() - JavaScript
syntax arr.shift() return value the removed element from the array;
undefined if the array is empty.
...if the length property is 0,
undefined is returned.
...in the following example every iteration will remove the next element from an array, until it is empty: var names = ["andrew", "edward", "paul", "chris" ,"john"]; while( (i = names.shift()) !==
undefined ) { console.log(i); } // andrew, edward, paul, chris, john specifications specification ecmascript (ecma-262)the definition of 'array.prototype.shift' in that specification.
Array - JavaScript
using an invalid index number returns
undefined.
... fruits.length = 10 console.log(fruits) // ['banana', 'apple', 'peach', empty x 2, 'mango', empty x 4] console.log(object.keys(fruits)) // ['0', '1', '2', '5'] console.log(fruits.length) // 10 console.log(fruits[8]) //
undefined decreasing the length property does, however, delete elements.
... array.prototype.find() returns the found element in the array, if some element in the array satisfies the testing function, or
undefined if not found.
Error.prototype.toString() - JavaScript
its semantics are as follows (assuming object and string have their original values): error.prototype.tostring = function() { 'use strict'; var obj = object(this); if (obj !== this) { throw new typeerror(); } var name = this.name; name = (name ===
undefined) ?
... 'error' : string(name); var msg = this.message; msg = (msg ===
undefined) ?
... '' : string(msg); if (name === '') { return msg; } if (msg === '') { return name; } return name + ': ' + msg; }; examples using tostring() var e = new error('fatal error'); console.log(e.tostring()); // 'error: fatal error' e.name =
undefined; console.log(e.tostring()); // 'error: fatal error' e.name = ''; console.log(e.tostring()); // 'fatal error' e.message =
undefined; console.log(e.tostring()); // '' e.name = 'hello'; console.log(e.tostring()); // 'hello' specifications specification ecmascript (ecma-262)the definition of 'error.prototype.tostring' in that specification.
Function.prototype.apply() - JavaScript
note that this may not be the actual value seen by the method: if the method is a function in non-strict mode code, null and
undefined will be replaced with the global object, and primitive values will be boxed.
... argsarray optional an array-like object, specifying the arguments with which func should be called, or null or
undefined if no arguments should be provided to the function.
... note: when the first argument is
undefined or null a similar outcome can be achieved using the array spread syntax.
Function.prototype.call() - JavaScript
if the method is a function in non-strict mode, null and
undefined will be replaced with the global object, and primitive values will be converted to objects.
... var sdata = 'wisen'; function display() { console.log('sdata value is %s ', this.sdata); } display.call(); // sdata value is wisen caution: in strict mode, the value of this will be
undefined.
... 'use strict'; var sdata = 'wisen'; function display() { console.log('sdata value is %s ', this.sdata); } display.call(); // cannot read the property of 'sdata' of
undefined specifications specification ecmascript (ecma-262)the definition of 'function.prototype.call' in that specification.
Map - JavaScript
let contacts = new map() contacts.set('jessie', {phone: "213-555-1234", address: "123 n 1st ave"}) contacts.has('jessie') // true contacts.get('hilary') //
undefined contacts.set('hilary', {phone: "617-555-4321", address: "321 s 2nd st"}) contacts.get('jessie') // {phone: "213-555-1234", address: "123 n 1st ave"} contacts.delete('raymond') // false contacts.delete('jessie') // true console.log(contacts.size) // 1 constructor map() creates a new map object.
... map.prototype.get(key) returns the value associated to the key, or
undefined if there is none.
...with keyfunc') mymap.size // 3 // getting the values mymap.get(keystring) // "value associated with 'a string'" mymap.get(keyobj) // "value associated with keyobj" mymap.get(keyfunc) // "value associated with keyfunc" mymap.get('a string') // "value associated with 'a string'" // because keystring === 'a string' mymap.get({}) //
undefined, because keyobj !== {} mymap.get(function() {}) //
undefined, because keyfunc !== function () {} using nan as map keys nan can also be used as a key.
Object - JavaScript
if the value is null or
undefined, it will create and return an empty object.
... object.prototype.__nosuchmethod__ allows a function to be defined that will be executed when an
undefined object member is called as a method.
... examples using object given
undefined and null types the following examples store an empty object object in o: let o = new object() let o = new object(
undefined) let o = new object(null) using object to create boolean objects the following examples store boolean objects in o: // equivalent to o = new boolean(true) let o = new object(true) // equivalent to o = new boolean(false) let o = new object(boolean()) object proto...
handler.getOwnPropertyDescriptor() - JavaScript
return value the getownpropertydescriptor() method must return an object or
undefined.
... interceptions this trap can intercept these operations: object.getownpropertydescriptor() reflect.getownpropertydescriptor() invariants if the following invariants are violated, the proxy will throw a typeerror: getownpropertydescriptor() must return an object or
undefined.
... const obj = { a: 10 }; object.preventextensions(obj); const p = new proxy(obj, { getownpropertydescriptor: function(target, prop) { return
undefined; } }); object.getownpropertydescriptor(p, 'a'); // typeerror is thrown specifications specification ecmascript (ecma-262)the definition of '[[getownproperty]]' in that specification.
String.prototype.indexOf() - JavaScript
if no string is explicitly provided, searchvalue will be coerced to "
undefined", and this value will be searched for in str.
... so, for example: '
undefined'.indexof() will return 0, as
undefined is found at position 0 in the string
undefined.
... 'undefine'.indexof() however will return -1, as
undefined is not found in the string undefine.
TypedArray.prototype.findIndex() - JavaScript
if it is not provided, then
undefined is used.
... polyfill typedarray.prototype.findindex = array.prototype.findindex = array.prototype.findindex || function(evaluator, thisarg) { 'use strict'; if (!this) { throw new typeerror('array.prototype.some called on null or
undefined'); } if (typeof(evaluator) !== 'function') { if (typeof(evaluator) === 'string') { // attempt to convert it to a function if ( !
... (evaluator = eval(evaluator)) ){ throw new typeerror(); } } else { throw new typeerror(); } } var i; if (thisarg ===
undefined) { // optimize for thisarg for (i in this) { if (evaluator(this[i], i, this)) { return i; } } return -1; } for (i in this) { if (evaluator.call(thisarg, this[i], i, this)) { return i; } } return -1; }; examples find the index of a prime number in a typed array the following example finds the index of an element in the typed array that is a prime number (or returns -1 if there is no prime number).
WeakMap() constructor - JavaScript
null is treated as
undefined.
... examples using weakmap const wm1 = new weakmap(), wm2 = new weakmap(), wm3 = new weakmap(); const o1 = {}, o2 = function() {}, o3 = window; wm1.set(o1, 37); wm1.set(o2, 'azerty'); wm2.set(o1, o2); // a value can be anything, including an object or a function wm2.set(o3,
undefined); wm2.set(wm1, wm2); // keys and values can be any objects.
... wm1.get(o2); // "azerty" wm2.get(o2); //
undefined, because there is no key for o2 on wm2 wm2.get(o3); //
undefined, because that is the set value wm1.has(o2); // true wm2.has(o2); // false wm2.has(o3); // true (even if the value itself is '
undefined') wm3.set(o1, 37); wm3.get(o1); // 37 wm1.has(o1); // true wm1.delete(o1); wm1.has(o1); // false specifications specification ecmascript (ecma-262)the definition of 'weakmap constructor' in that specification.
WeakMap - JavaScript
weakmap.prototype.get(key) returns the value associated to the key, or
undefined if there is none.
... examples using weakmap const wm1 = new weakmap(), wm2 = new weakmap(), wm3 = new weakmap(); const o1 = {}, o2 = function() {}, o3 = window; wm1.set(o1, 37); wm1.set(o2, 'azerty'); wm2.set(o1, o2); // a value can be anything, including an object or a function wm2.set(o3,
undefined); wm2.set(wm1, wm2); // keys and values can be any objects.
... wm1.get(o2); // "azerty" wm2.get(o2); //
undefined, because there is no key for o2 on wm2 wm2.get(o3); //
undefined, because that is the set value wm1.has(o2); // true wm2.has(o2); // false wm2.has(o3); // true (even if the value itself is '
undefined') wm3.set(o1, 37); wm3.get(o1); // 37 wm1.has(o1); // true wm1.delete(o1); wm1.has(o1); // false implementing a weakmap-like class with a .clear() method class clearableweakmap { constructor(init) { this._wm = new weakmap(init); } clear() { this._wm = new weakmap(); } delete(k) { return this._wm.delete(k); } get(k) { return this._wm.get(k); } has(k) { return this._wm.has(k); } set(k, v) { this._wm.set(k, v); return this; } } specifications specification ...
eval() - JavaScript
if the completion value is empty,
undefined is returned.
... function test() { var x = 2, y = 4; console.log(eval('x + y')); // direct call, uses local scope, result is 6 var geval = eval; // equivalent to calling eval in the global scope console.log(geval('x + y')); // indirect call, uses global scope, throws referenceerror because `x` is
undefined (0, eval)('x + y'); // another example of indirect call } never use eval()!
... var str = 'if ( a ) { 1 + 1; } else { 1 + 2; }'; var a = true; var b = eval(str); // returns 2 console.log('b is : ' + b); a = false; b = eval(str); // returns 3 console.log('b is : ' + b); eval as a string defining function requires "(" and ")" as prefix and suffix var fctstr1 = 'function a() {}' var fctstr2 = '(function a() {})' var fct1 = eval(fctstr1) // return
undefined var fct2 = eval(fctstr2) // return a function specifications specification ecmascript (ecma-262)the definition of 'eval' in that specification.
null - JavaScript
null is not an identifier for a property of the global object, like
undefined can be.
...it is not defined and has never been initialized: foo; //referenceerror: foo is not defined // foo is known to exist now but it has no type or value: var foo = null; foo; //null examples difference between null and
undefined when checking for null or
undefined, beware of the differences between equality (==) and identity (===) operators, as the former performs type-conversion.
... typeof null // "object" (not "null" for legacy reasons) typeof
undefined // "
undefined" null ===
undefined // false null ==
undefined // true null === null // true null == null // true !null // true isnan(1 + null) // false isnan(1 +
undefined) // true specifications specification ecmascript (ecma-262)the definition of 'null value' in that specification.
Destructuring assignment - JavaScript
let a, b; [a, b] = [1, 2]; console.log(a); // 1 console.log(b); // 2 default values a variable can be assigned a default, in the case that the value unpacked from the array is
undefined.
... default values a variable can be assigned a default, in the case that the value unpacked from the object is
undefined.
... const {a = 10, b = 5} = {a: 3}; console.log(a); // 3 console.log(b); // 5 assigning to new variables names and providing default values a property can be both 1) unpacked from an object and assigned to a variable with a different name and 2) assigned a default value in case the unpacked value is
undefined.
Logical nullish assignment (??=) - JavaScript
the logical nullish assignment (x ??= y) operator only assigns if x is nullish (null or
undefined).
... syntax expr1 ??= expr2 description short-circuit evaluation the nullish coalescing operator is evaluated left to right, it is tested for possible short-circuit evaluation using the following rule: (some expression that is neither null nor
undefined) ??
... expr is short-circuit evaluated to the left-hand side expression if the left-hand side proves to be neither null nor
undefined.
Function expression - JavaScript
you can't use function expressions before you create them: console.log(nothoisted) //
undefined // even though the variable name is hoisted, the definition isn't.
... so it's
undefined.
... var foo = function() {} foo.name // "foo" var foo2 = foo foo2.name // "foo" var bar = function baz() {} bar.name // "baz" console.log(foo === foo2); // true console.log(typeof baz); //
undefined console.log(bar === baz); // false (errors because baz ==
undefined) examples creating an unnamed function the following example defines an unnamed function and assigns it to x.
new.target - JavaScript
in normal function calls, new.target is
undefined.
... in ordinary functions, it refers to the function itself, assuming it was invoked via the new operator; otherwise new.target is
undefined.
... examples new.target in function calls in normal function calls (as opposed to constructor function calls), new.target is
undefined.
yield - JavaScript
if omitted,
undefined is returned instead.
...in this case, execution of the generator ends and an iteratorresult is returned to the caller in which the value is
undefined and done is true.
... let applestore = countapplesales() // generator { } console.log(applestore.next()) // { value: 3, done: false } console.log(applestore.next()) // { value: 7, done: false } console.log(applestore.next()) // { value: 5, done: false } console.log(applestore.next()) // { value:
undefined, done: true } you can also send a value with next(value) into the generator.
function* - JavaScript
when a generator is finished, subsequent next() calls will not execute any of that generator's code, they will just return an object of this form: {value:
undefined, done: true}.
...'pretzel'); // 1 pretzel gen.next('california'); // 2 california gen.next('mayonnaise'); // 3 mayonnaise return statement in a generator function* yieldandreturn() { yield "y"; return "r"; yield "unreachable"; } var gen = yieldandreturn() console.log(gen.next()); // { value: "y", done: false } console.log(gen.next()); // { value: "r", done: true } console.log(gen.next()); // { value:
undefined, done: true } generator as an object property const someobj = { *generator () { yield 'a'; yield 'b'; } } const gen = someobj.generator() console.log(gen.next()); // { value: 'a', done: false } console.log(gen.next()); // { value: 'b', done: false } console.log(gen.next()); // { value:
undefined, done: true } generator as an object method class foo { *generator () { yiel...
...d 1; yield 2; yield 3; } } const f = new foo (); const gen = f.generator(); console.log(gen.next()); // { value: 1, done: false } console.log(gen.next()); // { value: 2, done: false } console.log(gen.next()); // { value: 3, done: false } console.log(gen.next()); // { value:
undefined, done: true } generator as a computed property class foo { *[symbol.iterator] () { yield 1; yield 2; } } const someobj = { *[symbol.iterator] () { yield 'a'; yield 'b'; } } console.log(array.from(new foo)); // [ 1, 2 ] console.log(array.from(someobj)); // [ 'a', 'b' ] generators are not constructable function* f() {} var obj = new f; // throws "typeerror: f is not a constructor generator defined in an expression const foo = function* () { yield 10; yield 20; }; const ...
Strict mode - JavaScript
any assignment that silently fails in normal code (assignment to a non-writable global or property, assignment to a getter-only property, assignment to a new property on a non-extensible object) will throw in strict mode: 'use strict'; // assignment to a non-writable global var
undefined = 5; // throws a typeerror var infinity = 5; // throws a typeerror // assignment to a non-writable property var obj1 = {}; object.defineproperty(obj1, 'x', { value: 42, writable: false }); obj1.x = 9; // throws a typeerror // assignment to a getter-only property var obj2 = { get x() { return 17; } }; obj2.x = 5; // throws a typeerror // assignment to a new property on a non-extensible object v...
...for a normal function, this is always an object: either the provided object if called with an object-valued this; the value, boxed, if called with a boolean, string, or number this; or the global object if called with an
undefined or null this.
...thus for a strict mode function, the specified this is not boxed into an object, and if unspecified, this will be
undefined: 'use strict'; function fun() { return this; } console.assert(fun() ===
undefined); console.assert(fun.call(2) === 2); console.assert(fun.apply(null) === null); console.assert(fun.call(
undefined) ===
undefined); console.assert(fun.bind(true)() === true); that means, among other things, that in browsers it's no longer possible to reference the window object through this inside a strict mode functi...
Autoplay guide for media and Web Audio APIs - Web media technologies
you might use code like this to accomplish the job: let startplaypromise = videoelem.play(); if (startplaypromise !==
undefined) { startplaypromise.then(() => { // start whatever you need to do only after playback // has begun.
... }).catch(error => { if (error.name === "notallowederror") { showplaybutton(videoelem); } else { // handle a load or playback error } }); } the first thing we do with the result of play() is make sure it's not
undefined.
...checking for
undefined prevents this code from failing with an error on older versions of web browsers.
system/environment - Archive of obsolete content
ariable by setting the property: env.foo = 'foo'; env.path += ':/my/path/' you can unset an environment variable by deleting the property: delete env.foo; limitations there is no way to enumerate existing environment variables, also env won't have any enumerable properties: console.log(object.keys(env)); // [] environment variable will be unset, show up as non-existing if it's set to null,
undefined or ''.
... env.foo = null; console.log('foo' in env); // false env.bar = ''; console.log(env.bar); //
undefined ...
JavaScript Object Management - Archive of obsolete content
*/ if (typeof 〈namespace〉 == "
undefined") { var 〈namespace〉 = {}; }; note: the naming standard that we normally follow is that the first part of the namespace corresponds to the development group (or company), and the second to the specific project.
... */ if (typeof 〈namespace〉 == "
undefined") { var 〈namespace〉 = { /** * initializes this object.
Menu - Archive of obsolete content
(note that any falsey value will suffice, including
undefined, null, and the empty string.
...if this property is
undefined, the item is a normal menuitem.
appendNotification - Archive of obsolete content
if (typeof window === "
undefined") { //if there is no window defined, get the most recent.
... var window=components.classes["@mozilla.org/appshell/window-mediator;1"] .getservice(components.interfaces.nsiwindowmediator) .getmostrecentwindow("navigator:browser"); } if (typeof gbrowser === "
undefined") { //if there is no gbrowser defined, get it var gbrowser = window.gbrowser; } function testnotificationbutton1callback(thenotification, buttoninfo, eventtarget) { window.alert("button 1 pressed"); //prevent notification from closing: return true; }; function testnotificationbutton2callback(thenotification, buttoninfo, eventtarget) { window.alert("button 2 pressed"); //do not prevent notification from closing: }; function testnotificationca...
window - Archive of obsolete content
amenode, issupported(), lookupnamespaceuri, lookupprefix, normalize(), queryselector(), queryselectorall(), removeattribute(), removeattributenode(), removeattributens(), removechild(), removeeventlistener(), replacechild(), setattribute(), setattributenode(), setattributenodens(), setattributens(), setuserdata see also: dom window object methods note the error message "xml parsing error:
undefined entity...<window" can be caused by a missing or unreachable dtd file referenced in the xul file.
... a filename following the system keyword in a doctype declaration may silently fail to load and the only error message will be an
undefined entity error on the next xul element.
Object.prototype.watch() - Archive of obsolete content
return value
undefined.
... examples using watch and unwatch const o = { p: 1 }; o.watch('p', (id, oldval, newval) => { console.log('o.' + id + ' changed from ' + oldval + ' to ' + newval); return newval; }); o.p = 2; o.p = 3; delete o.p; o.p = 4; o.unwatch('p'); o.p = 5; this script displays the following: o.p changed from 1 to 2 o.p changed from 2 to 3 o.p changed from
undefined to 4 using watch() to validate an object's properties you can use watch to test any assignment to an object's properties.
Sharp variables in JavaScript - Archive of obsolete content
var a = { foo:[], bar:
undefined }; a.bar = a.foo; a.foo.push("hello"); a.bar.push("there!"); alert(a.foo[1]); // "there!" cyclic references sharp variables can be used to create a circularly linked list in one line of code.
... var a = {val:1, next:{val:2, next:
undefined} }; a.next.next = a; a.val; // 1 a.next.val; // 2 a.next.next.val; // 1 a.next.next == a; // true multiple sharp variables var a = #1 = { val:#2=[], next:{val:[], next:{val:#02#, next:#1#}} }; // leading 0s don't matter a.val.push(1); a.next.val.push(2); a.val[0]; // 1 a.next.val[0]; // 2 a.next.next.val[0]; // 1 a.next.next.next.val[0]; // 1 a == a.next.next; // false a == a.next.next.next; ...
Falsy - MDN Web Docs Glossary: Definitions of Web-related terms
"" empty string value null null - the absence of any value
undefined undefined - the primitive value nan nan - not a number objects are falsy if and only if they have the [[ishtmldda]] internal slot.
... examples examples of falsy values in javascript (which are coerced to false in boolean contexts, and thus bypass the if block): if (false) if (null) if (
undefined) if (0) if (-0) if (0n) if (nan) if ("") the logical and operator, && if the first object is falsy, it returns that object false && "dog" // ↪ false 0 && "dog" // ↪ 0 specifications specification ecmascript (ecma-262)the definition of 'toboolean abstract operation' in that specification.
NaN - MDN Web Docs Glossary: Definitions of Web-related terms
nan (not a number) is a numeric data type that means an
undefined value or value that cannot be represented, especially results of floating-point calculations.
... practically speaking, if i divide two variables in a javascript program, the result may be nan, which is predefined in javascript as "
undefined".
Primitive - MDN Web Docs Glossary: Definitions of Web-related terms
there are 6 primitive data types: string, number, bigint, boolean,
undefined, and symbol.
... primitive wrapper objects in javascript except for null and
undefined, all primitive values have object equivalents that wrap around the primitive values: string for the string primitive.
Function return values - Learn web development
(in these cases, our reference pages list the return value as void or
undefined.) for example, in the displaymessage() function we built in the previous article, no specific value is returned when the function is invoked.
...below the two existing lines of javascript, add the following function definitions: function squared(num) { return num * num; } function cubed(num) { return num * num * num; } function factorial(num) { if (num < 0) return
undefined; if (num == 0) return 1; let x = num - 1; while (x > 1) { num *= x; x--; } return num; } the squared() and cubed() functions are fairly obvious — they return the square or cube of the number that was given as a parameter.
mozbrowsermetachange
this can be added, changed, removed, or
undefined.
...if not included, the value returned is
undefined.
CustomizableUI.jsm
aarea will be the area the item is dragged to, or
undefined after the measurements have been done and the node has been moved back to its 'regular' area.
... parameters aelement the dom node whose place we need to check return value "toolbar" if the node is in a toolbar, "panel" if it is in the menu panel, "palette" if it is in the (visible!) customization palette,
undefined otherwise.
Dict.jsm
if you don't specify a default value,
undefined is returned for keys that aren't found.
... return value the value of the specified key, or
undefined if no matching key was found.
DownloadTarget
for downloads of multiple files, such as downloading a web page and its required media to disk, the meaning of this property is
undefined.
... promise resolves to
undefined when the state of the download has been updated.
Http.jsm
httprequest supports the following parameters: name meaning headers an array of headers postdata this can be: a string: send it as is an array of parameters: encode as form values null/
undefined: no post data.
...when null/
undefined is given, no post data will be attached.
Deferred
void resolve( avalue ); parameters avalue optional if this value is not a promise, including
undefined, it becomes the fulfillment value of the associated promise.
...although the reason can be
undefined, it is generally an error object, like in exception handling.
L20n Javascript API
if it is
undefined, or if registerlocales hasn't been called at all, the context instance will create a special locale called i-default to be used as the default.
... ctx.requestlocales('pl'); ctx.requestlocales('fr-ca', 'fr'); if requestedlocales argument list is empty or
undefined, the default locale from registerlocales will be used.
NSS_3.12_release_notes.html
bug 401610: shared db fails on iopr tests bug 388120: build error due to sec_begin_protos / sec_end_protos are
undefined bug 415264: make security use of new nspr rotate macros bug 317052: lib/base/whatnspr.c is obsolete bug 317323: set nspr31_lib_prefix to empty explicitly for win95 and wince builds bug 320336: secitem_allocitem returns a non-null pointer if the allocation of its 'data' buffer fails bug 327529: can't pass 0 as an unnamed null pointer argument to cert_createrdn bug 334683: extraneous semicolons cau...
...bug 384926: libpkix build problems bug 389411: mingw build error -
undefined reference to `_imp__pkix_errornames' bug 389904: avoid multiple decoding/encoding while creating and using pkix_pl_x500name bug 390209: pkix aia manager tries to get certs using aia url with ocsp access method bug 390233: umbrella bug for libpkix cert validation failures discovered from running vfyserv bug 390499: libpkix does not check cached cert chain for revocation bug 390502: libpkix fails c...
Build instructions
these variables should be either
undefined, or set to "1".
... results are
undefined for variables set to "0".
The JavaScript Runtime
these types are implemented with the following java types and values: javascript fundamental type java type
undefined a singleton object defined by context.get
undefinedtype() null null boolean java.lang.boolean number java.lang.number, that is, any of java.lang.byte, java.lang.short, java.lang.integer, java.lang.float, or java.lang.double.
... the behavior of the javascript engine is
undefined if a value of any type other than the ones described above is introduced into javascript.
JSAPI User Guide
a js::value can be a number, a string, a boolean value, a reference to an object (like an object, array, date, or function), or one of the special values null or
undefined.
...these are isobject(), isnumber(), isint32(), isdouble(), isstring(), isboolean(), isnull(), and is
undefined().
JS::CallArgs
js::handlevalue get(unsigned i) const returns the i-th zero-indexed argument, or
undefined if there's no such argument.
... bool hasdefined(unsigned i) const returns true if the i-th zero-indexed argument is present and is not
undefined.
JSPropertyOp
on entry, *vp contains the property's stored value or
undefined if the property doesn't have a stored value.
... on entry, *vp contains the property's stored value, or
undefined if the property doesn't exist or doesn't have a stored value.
JSVAL_IS_VOID
determines if a given jsval is the javascript value
undefined.
... syntax jsval_is_void(v) description jsval_is_void(v) is true if v is jsval_void, which represents the javascript value
undefined.
JSVAL_VOID
the jsval that represents the javascript value
undefined.
... syntax jsval_void description jsval_void is a jsval constant that represents the javascript value
undefined.
JS_GetPropertyDefault
on success, *vp receives the current value of the property, or
undefined if no such property is found.
...on an error or exception, these functions return false, and the value left in *vp is
undefined.
JS_ValueToNumber
if v is
undefined, null, false, or true, conversion succeeds, and the result is nan, 0, 0, or 1 respectively.
...on error or exception, it returns js_false, and the value left in *dp is
undefined.
Components.utils.unwaiveXrays
the chrome code can then use unwaivexrays to restore xray protection: // chrome code // contentwindow is an xray var isxray = components.utils.isxraywrapper(gbrowser.contentwindow); // true // expandos are not visible in xrays var foo = gbrowser.contentwindow.foo; //
undefined // you can waive xray vision for an object var waived = components.utils.waivexrays(gbrowser.contentwindow); isxray = components.utils.isxraywrapper(waived); // false foo = waived.foo; // "i'm an expando" // waiving is transitive isxray = components.utils.isxraywrapper(waived.document); // false // use unwaive...
...xrays to undo the waiver var unwaived = components.utils.unwaivexrays(waived); isxray = components.utils.isxraywrapper(unwaived); // true foo = unwaived.foo; //
undefined // unwaiving is transitive isxray = components.utils.isxraywrapper(unwaived.document); // true ...
nsICacheEntryDescriptor
an offset beyond the end of the stream has
undefined consequences.
...an offset beyond the end of the stream has
undefined consequences.
nsIHttpChannel
warning: calling setrequestheader(), setreferrerwithpolicy() or setemptyrequestheader() while visiting request headers has
undefined behavior until gecko 47 (firefox 47.0 / thunderbird 47.0 / seamonkey 2.44).
... warning: calling setresponseheader() while visiting response headers has
undefined behavior until gecko 48 (firefox 48.0 / thunderbird 48.0 / seamonkey 2.45).
nsIWebNavigation
(
undefined bits are reserved for future use.) generally you will pass load_flags_none for this parameter.
...(
undefined bits are reserved for future use.) generally you will pass load_flags_none for this parameter.
nsIWebProgressListener
any
undefined bits are reserved for future use.
...any
undefined bits are reserved for future use.
Xray vision
ty of a dom object, and then it will be filtered out by the dom xray: // content code // redefine date.getfullyear() date.prototype.getfullyear = function() {return 1000}; var date = new date(); // chrome code // contentwindow is an xray, and date is an expando on contentwindow // so date is filtered out gbrowser.contentwindow.date.getfullyear() // -> typeerror: gbrowser.contentwindow.date is
undefined the chrome code will only even see date if it waives xrays, and then, because waiving is transitive, it should expect to be vulnerable to redefinition: // chrome code components.utils.waivexrays(gbrowser.contentwindow).date.getfullyear(); // -> 1000 however, there are some situations in which privileged code will access javascript objects that are not themselves dom objects and are not proper...
...log("3) value property defined by assignment to this:"); console.log(sandbox.me.firstname); // -> "joe" // 4) value properties defined using defineproperty are visible: console.log("4) value property defined by defineproperty"); console.log(sandbox.me.lastname); // -> "smith" // 5) accessor properties are not visible console.log("5) accessor property"); console.log(sandbox.me.middlename); // ->
undefined // 6) accessing a value property of a value-property object is fine console.log("6) value property of a value-property object"); console.log(sandbox.me.address.street); // -> "main street" // 7) functions defined on the sandbox-defined object are not visible in the xray console.log("7) call a function defined on the object"); try { console.log(sandbox.me.fullname()); } catch (e) { console.e...
Add to iPhoto
the code to identify the node looks like this: getcurrentnode: function() { var node = document.popupnode; // if no node, just return null now if (node ==
undefined || !node) { return null; } // is it an image node?
...if this is null or
undefined, we immediately return null, indicating there is no node associated with the context menu.
Declaring and Using Callbacks
when void is the return type, the javascript callback must not return, or it should return
undefined.
... var myfunctypedeclaration = ctypes.functiontype(ctypes.default_abi, ctypes.void_t, []); function myjscallback() { return
undefined; // as the return of the functiontype was ctypes.void_t we must return
undefined or dont return at all otherwise js-ctypes will throw an error saying unexpected type } var myccallback = myfunctypedeclaration.ptr(myjscallback); using callbacks since callbacks are function pointers in c, js-ctypes has special handling for function pointer types.
Debugger.Memory - Firefox Developer Tools
on a new debugger.memory instance, each of these properties is initially
undefined.
... any value assigned to a debugging handler must be either a function or
undefined; otherwise a typeerror is thrown.
Rich output - Firefox Developer Tools
the output will look something like this: console.log(todolist) array(4) [ {…}, {…}, {…}, {…} ] debugger eval code:1:9
undefined if you expand objects, such as arrays, you get slightly different content.
...orning pages", datecreated: 1552404478137 } 1: object { status: "in progress", description: "refactor styles", datecreated: 1552404493169 } 2: object { status: "to do", description: "create feedback form", datecreated: 1552404512630 } 3: object { status: "to do", description: "normalize table", datecreated: 1552404533790 } length: 4 <prototype>: array [] debugger eval code:1:9
undefined highlighting and inspecting dom nodes if you hover the mouse over any dom element in the console output, it's highlighted on the page: in the screenshot above you'll also see a blue "target" icon next to the node in the console output: click it to switch to the inspector with that node selected.
AudioNode.connect() - Web APIs
in some browsers, older implementations of this interface return
undefined.
... if the destination is an audioparam, connect() returns
undefined.
Using the CSS Typed Object Model - Web APIs
); } for those of you using a non-supporting browser, the above output should looks something like this: property value unit padding-top 0 px margin-bottom 16 px font-size 16 px font-stretch 100 percent animation-duration 0 s animation-iteration-count 1 number width auto
undefined height auto
undefined you'll note the <length> unit returned is px, the <percentage> unit returned is percent, the <time> unit is s for 'seconds', and the unitless <number> unit is number.
...csskeywordvalues do not have a unit property, so in these cases our get().unit returns
undefined.
Cache.match() - Web APIs
if no match is found, the promise resolves to
undefined.
... return value a promise that resolves to the first response that matches the request or to
undefined if no match is found.
CacheStorage - Web APIs
window.caches will be
undefined unless an ssl certificate is configured.
... '/sw-test/gallery/bountyhunters.jpg', '/sw-test/gallery/mylittlevader.jpg', '/sw-test/gallery/snowtroopers.jpg' ]); }) ); }); self.addeventlistener('fetch', function(event) { event.respondwith(caches.match(event.request).then(function(response) { // caches.match() always resolves // but in case of success response will have value if (response !==
undefined) { return response; } else { return fetch(event.request).then(function (response) { // response may be used only once // we need to save clone to put one copy in cache // and serve second one let responseclone = response.clone(); caches.open('v1').then(function (cache) { cache.put(event.request, responseclone); }); ...
CanvasRenderingContext2D.putImageData() - Web APIs
html <canvas id="canvas"></canvas> javascript var canvas = document.getelementbyid('canvas'); var ctx = canvas.getcontext('2d'); function putimagedata(ctx, imagedata, dx, dy, dirtyx, dirtyy, dirtywidth, dirtyheight) { var data = imagedata.data; var height = imagedata.height; var width = imagedata.width; dirtyx = dirtyx || 0; dirtyy = dirtyy || 0; dirtywidth = dirtywidth !==
undefined?
... dirtywidth: width; dirtyheight = dirtyheight !==
undefined?
CustomElementRegistry.whenDefined() - Web APIs
return value a promise that resolves to
undefined when the custom element is defined.
...const
undefinedelements = container.queryselectorall(':not(:defined)'); const promises = [...
undefinedelements].map( button => customelements.whendefined(button.localname) ); // wait for all the children to be upgraded, // then remove the placeholder.
DataTransferItem.getAsString() - Web APIs
return value
undefined callback the callback parameter is a callback function which accepts one parameter: domstring the drag data item's string data.
... the callback return value is
undefined.
FetchEvent.preloadResponse - Web APIs
the preloadresponse read-only property of the fetchevent interface returns a promise that resolves to the navigation preload response if navigation preload was triggered or
undefined otherwise.
... syntax var expectedresponse = fetchevent.preloadresponse; value a promise that resolves to a response or otherwise to
undefined.
HTMLCollection - Web APIs
an alternative to accessing collection[i] (which instead returns
undefined when i is out-of-bounds).
... an alternative to accessing collection[name] (which instead returns
undefined when name does not exist).
IDBCursor - Web APIs
if the cursor is outside its range, this is set to
undefined.
...if the cursor is currently being iterated or has iterated outside its range, this is set to
undefined.
IDBFactory.deleteDatabase() - Web APIs
if the database is successfully deleted, then a success event is fired on the request object returned from this method, with its result set to
undefined.
... example var dbdeleterequest = window.indexeddb.deletedatabase("todolist"); dbdeleterequest.onerror = function(event) { console.log("error deleting database."); }; dbdeleterequest.onsuccess = function(event) { console.log("database deleted successfully"); console.log(event.result); // should be
undefined }; specifications specification status comment indexed database api draftthe definition of 'deletedatabase()' in that specification.
IDBKeyRange - Web APIs
bound(x, y) all keys > x &&< y idbkeyrange.bound(x, y, true, true) all keys > x && ≤ y idbkeyrange.bound(x, y, true, false) all keys ≥ x &&< y idbkeyrange.bound(x, y, false, true) the key = z idbkeyrange.only(z) a key is in a key range if the following conditions are true: the lower value of the key range is one of the following:
undefined less than key value equal to key value if loweropen is false.
... the upper value of the key range is one of the following:
undefined greater than key value equal to key value if upperopen is false.
KeyboardEvent.keyCode - Web APIs
example window.addeventlistener("keydown", function (event) { if (event.defaultprevented) { return; // should do nothing if the default action has been cancelled } var handled = false; if (event.key !==
undefined) { // handle the event with keyboardevent.key and set handled true.
... } else if (event.keycode !==
undefined) { // handle the event with keyboardevent.keycode and set handled true.
LockManager.request() - Web APIs
the requested lock is passed to a callback, while the function itself returns a promise that resolves with
undefined.
... callback … return value a promise that resolves with
undefined when the request is granted.
MediaKeyStatusMap.get() - Web APIs
the get property of the mediakeystatusmap interface returns the value associated with the given key, or
undefined if there is none.
... returns the value associated with the given key, or
undefined.
Page Visibility API - Web APIs
the example, which pauses the video when you switch to another tab and plays again when you return to its tab, was created with the following code: // set the name of the hidden property and the change event for visibility var hidden, visibilitychange; if (typeof document.hidden !== "
undefined") { // opera 12.10 and firefox 18 and later support hidden = "hidden"; visibilitychange = "visibilitychange"; } else if (typeof document.mshidden !== "
undefined") { hidden = "mshidden"; visibilitychange = "msvisibilitychange"; } else if (typeof document.webkithidden !== "
undefined") { hidden = "webkithidden"; visibilitychange = "webkitvisibilitychange"; } var videoelement = document.
...getelementbyid("videoelement"); // if the page is hidden, pause the video; // if the page is shown, play the video function handlevisibilitychange() { if (document[hidden]) { videoelement.pause(); } else { videoelement.play(); } } // warn if the browser doesn't support addeventlistener or the page visibility api if (typeof document.addeventlistener === "
undefined" || hidden ===
undefined) { console.log("this demo requires a browser, such as google chrome or firefox, that supports the page visibility api."); } else { // handle page visibility change document.addeventlistener(visibilitychange, handlevisibilitychange, false); // when the video pauses, set the title.
performance.measure() - Web APIs
syntax performance.measure(name); performance.measure(name, startmark); performance.measure(name, startmark, endmark); performance.measure(name,
undefined, endmark); arguments name a domstring representing the name of the measure.
... performance.measure("measure a to b", markernamea, markernameb); performance.measure("measure a to now", markernamea); performance.measure("measure from navigation start to b",
undefined, markernameb); performance.measure("measure from the start of navigation to now"); // pull out all of the measurements.
Using Performance Timeline - Web APIs
bytagname("output")[0]; o.innerhtml += s + " <br>"; } function do_work (n) { for (var i=0 ; i < n; i++) { var m = math.random(); } } function print_perf_entry(pe) { log("..name: " + pe.name + "; entrytype: " + pe.entrytype + "; starttime: " + pe.starttime + "; duration: " + pe.duration); } function print_performanceentries() { if (performance.mark ===
undefined) { log("...
... function perfentry_tojson() { // create a few performance entries performance.mark("mark-1"); performance.mark("mark-2"); performance.measure("meas-1", "mark-1", "mark-2"); var pelist = performance.getentries(); var pe = pelist[0]; if (pe.tojson ===
undefined) { log ("performanceentry.tojson() is not supported"); return; } // print the performanceentry object var json = pe.tojson(); var s = json.stringify(json); log("performanceentry.tojson = " + s); } performance observers the performance observer interfaces allow an application to register an observer for specific performance event types, and when one of those event types is...
ReadableByteStreamController.byobRequest - Web APIs
the byobrequest read-only property of the readablebytestreamcontroller interface returns the current byob pull request, or
undefined if there are no pending requests.
... syntax var request = readablebytestreamcontroller.byobrequest; value a readablestreambyobrequest object instance, or
undefined.
SpeechSynthesis.getVoices() - Web APIs
example javascript function populatevoicelist() { if(typeof speechsynthesis === '
undefined') { return; } var voices = speechsynthesis.getvoices(); for(var i = 0; i < voices.length; i++) { var option = document.createelement('option'); option.textcontent = voices[i].name + ' (' + voices[i].lang + ')'; if(voices[i].default) { option.textcontent += ' -- default'; } option.setattribute('data-lang', voices[i].lang); option.setattribute('data-name'...
..., voices[i].name); document.getelementbyid("voiceselect").appendchild(option); } } populatevoicelist(); if (typeof speechsynthesis !== '
undefined' && speechsynthesis.onvoiceschanged !==
undefined) { speechsynthesis.onvoiceschanged = populatevoicelist; } html <select id="voiceselect"></select> specifications specification status comment web speech apithe definition of 'getvoices()' in that specification.
URLSearchParams.sort() - Web APIs
the urlsearchparams.sort() method sorts all key/value pairs contained in this object in place and returns
undefined.
... return value
undefined.
Window.prompt() - Web APIs
note that in internet explorer 7 and 8, if you do not provide this parameter, the string "
undefined" is the default value.
...it does not display a prompt to the user, and always returns
undefined.
Window.scrollX - Web APIs
a fully compatible example: var x = (window.pagexoffset !==
undefined) ?
... window.pagexoffset : (document.documentelement || document.body.parentnode || document.body).scrollleft; var y = (window.pageyoffset !==
undefined) ?
WindowOrWorkerGlobalScope.setInterval() - Web APIs
example: var intervalid = setinterval(function(arg1) {}.bind(
undefined, 10), 1000); inactive tabs requires gecko 5.0(firefox 5.0 / thunderbird 5.0 / seamonkey 2.2) starting in gecko 5.0 (firefox 5.0 / thunderbird 5.0 / seamonkey 2.2), intervals are clamped to fire no more often than once per second in inactive tabs.
...this[sproperty] : this); }; myarray.mymethod(); // prints "zero,one,two" myarray.mymethod(1); // prints "one" settimeout(myarray.mymethod, 1000); // prints "[object window]" after 1 second settimeout(myarray.mymethod, 1500, "1"); // prints "
undefined" after 1,5 seconds // passing the 'this' object with .call won't work // because this will change the value of this inside settimeout itself // while we want to change the value of this inside myarray.mymethod // in fact, it will be an error because settimeout code expects this to be the window object: settimeout.call(myarray, myarray.mymethod, 2000); // error: "ns_error_xpc_bad_op_on_wn_proto: i...
WindowOrWorkerGlobalScope.setTimeout() - Web APIs
example: settimeout(function(arg1){}.bind(
undefined, 10), 1000); the "this" problem when you pass a method to settimeout() (or any other function, for that matter), it will be invoked with a this value that may differ from your expectation.
...however, in the following: settimeout(myarray.mymethod, 1.0*1000); // prints "[object window]" after 1 second settimeout(myarray.mymethod, 1.5*1000, '1'); // prints "
undefined" after 1.5 seconds the myarray.mymethod function is passed to settimeout, then when it's called, its this is not set so it defaults to the window object.
ARIA: row role - Accessibility
aria-expended="
undefined" or the attribute is missing: the row is neither expandable nor collapsible.
... aria-selected="
undefined" or the attribute is missing: the row is not selectable.
max-height - CSS: Cascading Style Sheets
ox for androidopera for androidsafari on iossamsung internetmax-heightchrome full support 18edge full support 12firefox full support 1notes full support 1notes notes css 2.1 leaves the behavior of max-height with table
undefined.
... firefox supports applying max-height to table elements.ie full support 7opera full support 7notes full support 7notes notes css 2.1 leaves the behavior of max-height with table
undefined.
Working with objects - JavaScript
object(); mycar.make = 'ford'; mycar.model = 'mustang'; mycar.year = 1969; the above example could also be written using an object initializer, which is a comma-delimited list of zero or more pairs of property names and associated values of an object, enclosed in curly braces ({}): var mycar = { make: 'ford', model: 'mustang', year: 1969 }; unassigned properties of an object are
undefined (and not null).
... mycar.color; //
undefined properties of javascript objects can also be accessed or set using a bracket notation (for more details see property accessors).
Classes - JavaScript
class point { constructor(x, y) { this.x = x; this.y = y; } static distance(a, b) { const dx = a.x - b.x; const dy = a.y - b.y; return math.hypot(dx, dy); } } const p1 = new point(5, 5); const p2 = new point(10, 10); p1.distance; //
undefined p2.distance; //
undefined console.log(point.distance(p1, p2)); // 7.0710678118654755 binding this with prototype and static methods when a static or prototype method is called without a value for this, such as by assigning a variable to the method and then calling it, the this value will be
undefined inside the method.
... class animal { speak() { return this; } static eat() { return this; } } let obj = new animal(); obj.speak(); // the animal object let speak = obj.speak; speak(); //
undefined animal.eat() // class animal let eat = animal.eat; eat(); //
undefined if we rewrite the above using traditional function-based syntax in non–strict mode, then this method calls is automatically bound to the initial this value, which by default is the global object.
TypeError: invalid Array.prototype.sort argument - JavaScript
the javascript exception "invalid array.prototype.sort argument" occurs when the argument of array.prototype.sort() isn't either
undefined or a function which compares its operands.
... the argument of array.prototype.sort() is expected to be either
undefined or a function which compares its operands.
getter - JavaScript
const obj = { log: ['example','test'], get latest() { if (this.log.length === 0) return
undefined; return this.log[this.log.length - 1]; } } console.log(obj.latest); // "test" note that attempting to assign a value to latest will not change it.
... class example { get hello() { return 'world'; } } const obj = new example(); console.log(obj.hello); // "world" console.log(object.getownpropertydescriptor(obj, 'hello')); //
undefined console.log( object.getownpropertydescriptor( object.getprototypeof(obj), 'hello' ) ); // { configurable: true, enumerable: false, get: function get hello() { return 'world'; }, set:
undefined } specifications specification ecmascript (ecma-262)the definition of 'method definitions' in that specification.
Array() constructor - JavaScript
arraylength if the only argument passed to the array constructor is an integer between 0 and 232-1 (inclusive), this returns a new javascript array with its length property set to that number (note: this implies an array of arraylength empty slots, not slots with actual
undefined values).
... let fruits = new array(2); console.log(fruits.length); // 2 console.log(fruits[0]); //
undefined array constructor with multiple parameters if more than one argument is passed to the constructor, a new array with the given elements is created.
Array.prototype.reduce() - JavaScript
on steps of ecma-262, edition 5, 15.4.4.21 // reference: http://es5.github.io/#x15.4.4.21 // https://tc39.github.io/ecma262/#sec-array.prototype.reduce if (!array.prototype.reduce) { object.defineproperty(array.prototype, 'reduce', { value: function(callback /*, initialvalue*/) { if (this === null) { throw new typeerror( 'array.prototype.reduce ' + 'called on null or
undefined' ); } if (typeof callback !== 'function') { throw new typeerror( callback + ' is not a function'); } // 1.
...call( // callbackfn,
undefined, // « accumulator, kvalue, k, o »).
Array.prototype.forEach() - JavaScript
return value
undefined.
...(see this example, below.) foreach() executes the callback function once for each array element; unlike map() or reduce() it always returns the value
undefined and is not chainable.
Array.prototype.indexOf() - JavaScript
// this version tries to optimize by only checking for "in" when looking for
undefined and // skipping the definitely fruitless nan search.
...if (!array.prototype.indexof) array.prototype.indexof = (function(object, max, min) { "use strict" return function indexof(member, fromindex) { if (this === null || this ===
undefined) throw typeerror("array.prototype.indexof called on null or
undefined") var that = object(this), len = that.length >>> 0, i = min(fromindex | 0, len) if (i < 0) i = max(0, len + i) else if (i >= len) return -1 if (member === void 0) { //
undefined for (; i !== len; ++i) if (that[i] === void 0 && i in that) return i } else if (member !== member) { // nan return -1 // since nan !== nan, it will never be found.
Array.isArray() - JavaScript
array.isarray([1, 2, 3]); // true array.isarray({foo: 123}); // false array.isarray('foobar'); // false array.isarray(
undefined); // false syntax array.isarray(value) parameters value the value to be checked.
...es using array.isarray // all following calls return true array.isarray([]); array.isarray([1]); array.isarray(new array()); array.isarray(new array('a', 'b', 'c', 'd')); array.isarray(new array(3)); // little known fact: array.prototype itself is an array: array.isarray(array.prototype); // all following calls return false array.isarray(); array.isarray({}); array.isarray(null); array.isarray(
undefined); array.isarray(17); array.isarray('array'); array.isarray(true); array.isarray(false); array.isarray(new uint8array(32)); array.isarray({ __proto__: array.prototype }); instanceof vs isarray when checking for array instance, array.isarray is preferred over instanceof because it works through iframes.
Array.of() - JavaScript
the difference between array.of() and the array constructor is in the handling of integer arguments: array.of(7) creates an array with a single element, 7, whereas array(7) creates an empty array with a length property of 7 (note: this implies an array of 7 empty slots, not slots with actual
undefined values).
... if (!array.of) { array.of = function() { return array.prototype.slice.call(arguments); // or let vals = []; for(let prop in arguments){ vals.push(arguments[prop]); } return vals; } } examples using array.of array.of(1); // [1] array.of(1, 2, 3); // [1, 2, 3] array.of(
undefined); // [
undefined] specifications specification ecmascript (ecma-262)the definition of 'array.of' in that specification.
Array.prototype.pop() - JavaScript
syntax arrname.pop() return value the removed element from the array;
undefined if the array is empty.
... if you call pop() on an empty array, it returns
undefined.
Array.prototype.some() - JavaScript
otherwise, the value
undefined will be used as its this value.
... // production steps of ecma-262, edition 5, 15.4.4.17 // reference: http://es5.github.io/#x15.4.4.17 if (!array.prototype.some) { array.prototype.some = function(fun, thisarg) { 'use strict'; if (this == null) { throw new typeerror('array.prototype.some called on null or
undefined'); } if (typeof fun !== 'function') { throw new typeerror(); } var t = object(this); var len = t.length >>> 0; for (var i = 0; i < len; i++) { if (i in t && fun.call(thisarg, t[i], i, t)) { return true; } } return false; }; } examples testing value of array elements the following example tests whether any element in the array is ...
Boolean - JavaScript
if the value is omitted or is 0, -0, null, false, nan,
undefined, or the empty string (""), the object has an initial value of false.
... any object of which the value is not
undefined or null, including a boolean object whose value is false, evaluates to true when passed to a conditional statement.
Date.prototype.toLocaleString() - JavaScript
the default value for each date-time component property is
undefined.
... but, if the weekday, year, month, and day properties are all
undefined, then year, month, and day are assumed to be "numeric".
Error.prototype.stack - JavaScript
"
undefined" is listed as "(void 0)".
... <!doctype html> <meta charset="utf-8"> <title>stack trace example</title> <body> <script> function trace() { try { throw new error('myerror'); } catch(e) { alert(e.stack); } } function b() { trace(); } function a() { b(3, 4, '\n\n',
undefined, {}); } a('first call, firstarg'); </script> assuming the above markup is saved as c:\example.html on a windows file system it produces an alert message box with the following text: starting with firefox 30 and later containing the column number: trace@file:///c:/example.html:9:17 b@file:///c:/example.html:16:13 a@file:///c:/example.html:19:13 @file:///c:/example.html:21:9 firefox 14 to fire...
Function.displayName - JavaScript
by entering the following in a console, it should display as something like "function my function()": var a = function() {}; a.displayname = 'my function'; a; // "function my function()" when defined, the displayname property returns the display name of a function: function dosomething() {} console.log(dosomething.displayname); // "
undefined" var popup = function(content) { console.log(content); }; popup.displayname = 'show popup'; console.log(popup.displayname); // "show popup" defining a displayname in function expressions you can define a function with a display name in a function expression: var object = { somemethod: function() {} }; object.somemethod.displayname = 'somemethod'; console.log(object.somemethod.displayna...
...me); // logs "somemethod" try { somemethod } catch(e) { console.log(e); } // referenceerror: somemethod is not defined changing displayname dynamically you can dynamically change the displayname of a function: var object = { // anonymous somemethod: function(value) { arguments.callee.displayname = 'somemethod (' + value + ')'; } }; console.log(object.somemethod.displayname); // "
undefined" object.somemethod('123') console.log(object.somemethod.displayname); // "somemethod (123)" specifications not part of any standard.
Generator.prototype.next() - JavaScript
xamples using next() the following example shows a simple generator and the object that the next method returns: function* gen() { yield 1; yield 2; yield 3; } const g = gen(); // "generator { }" g.next(); // "object { value: 1, done: false }" g.next(); // "object { value: 2, done: false }" g.next(); // "object { value: 3, done: false }" g.next(); // "object { value:
undefined, done: true }" using next() with a list function* getpage(pagesize = 1, list) { let output = []; let index = 0; while (index < list.length) { output = []; for (let i = index; i < index + pagesize; i++) { if (list[i]) { output.push(list[i]); } } yield output; index += pagesize; } } list = [1, 2, 3, 4, 5, 6, 7, 8] var page = getpage(3, list); ...
... // generator { } page.next(); // object {value: (3) [1, 2, 3], done: false} page.next(); // object {value: (3) [4, 5, 6], done: false} page.next(); // object {value: (2) [7, 8], done: false} page.next(); // object {value:
undefined, done: true} sending values to the generator in this example, next is called with a value.
Generator.prototype.return() - JavaScript
function* gen() { yield 1; yield 2; yield 3; } const g = gen(); g.next(); // { value: 1, done: false } g.return('foo'); // { value: "foo", done: true } g.next(); // { value:
undefined, done: true } if return(value) is called on a generator that is already in "completed" state, the generator will remain in "completed" state.
... function* gen() { yield 1; yield 2; yield 3; } const g = gen(); g.next(); // { value: 1, done: false } g.next(); // { value: 2, done: false } g.next(); // { value: 3, done: false } g.next(); // { value:
undefined, done: true } g.return(); // { value:
undefined, done: true } g.return(1); // { value: 1, done: true } specifications specification ecmascript (ecma-262)the definition of 'generator.prototype.return' in that specification.
Intl.DateTimeFormat() constructor - JavaScript
to use the browser's default locale, omit this argument or pass
undefined.
...possible values are: "long" (e.g., british summer time) "short" (e.g., gmt+1) the default value for each date-time component property is
undefined, but if all component properties are
undefined, then year, month, and day are assumed to be "numeric".
Intl.DateTimeFormat.prototype.resolvedOptions() - JavaScript
timezone the value provided for this property in the options argument;
undefined (representing the runtime's default time zone) if none was provided.
... warning: applications should not rely on
undefined being returned, as future versions may return a string value identifying the runtime’s default time zone instead.
Intl - JavaScript
if the locales argument is not provided or is
undefined, the runtime's default locale is used.
...if the options argument is not provided or is
undefined, default values are used for all properties.
JSON.parse() - JavaScript
var k; var v; var value = holder[key]; if (value && typeof value === "object") { for (k in value) { if (object.prototype.hasownproperty.call(value, k)) { v = walk(value, k); if (v !==
undefined) { value[k] = v; } else { delete value[k]; } } } } return reviver.call(holder, key, value); } // parsing happens in four stages.
...if the reviver function returns
undefined (or returns no value, for example, if execution falls off the end of the function), the property is deleted from the object.
JSON - JavaScript
consider this example where json.parse() parses the string as json and eval executes the string as javascript: let code = '"\u2028\u2029"' json.parse(code) // evaluates to "\u2028\u2029" in all engines eval(code) // throws a syntaxerror in old engines other differences include allowing only double-quoted strings and having no provisions for
undefined or comments.
...by default, all instances of
undefined are replaced with null, and other unsupported native data types are censored.
Map.prototype.get() - JavaScript
return value the element associated with the specified key, or
undefined if the key can't be found in the map object.
... examples using get() let mymap = new map(); mymap.set('bar', 'foo'); mymap.get('bar'); // returns "foo" mymap.get('baz'); // returns
undefined specifications specification ecmascript (ecma-262)the definition of 'map.prototype.get' in that specification.
Math.ceil() - JavaScript
*/ function decimaladjust(type, value, exp) { // if the exp is
undefined or zero...
... if (typeof exp === '
undefined' || +exp === 0) { return math[type](value); } value = +value; exp = +exp; // if the value is not a number or the exp is not an integer...
Math.floor() - JavaScript
*/ function decimaladjust(type, value, exp) { // if the exp is
undefined or zero...
... if (typeof exp === '
undefined' || +exp === 0) { return math[type](value); } value = +value; exp = +exp; // if the value is not a number or the exp is not an integer...
Object() constructor - JavaScript
if the value is null or
undefined, it will create and return an empty object.
... examples creating a new object let o = new object() o.foo = 42 console.log(o) // object { foo: 42 } using object given
undefined and null types the following examples store an empty object object in o: let o = new object() let o = new object(
undefined) let o = new object(null) specifications specification ecmascript (ecma-262)the definition of 'object constructor' in that specification.
Object.prototype.__defineSetter__() - JavaScript
return value
undefined.
... examples non-standard and deprecated way var o = {}; o.__definesetter__('value', function(val) { this.anothervalue = val; }); o.value = 5; console.log(o.value); //
undefined console.log(o.anothervalue); // 5 standard-compliant ways // using the set operator var o = { set value(val) { this.anothervalue = val; } }; o.value = 5; console.log(o.value); //
undefined console.log(o.anothervalue); // 5 // using object.defineproperty var o = {}; object.defineproperty(o, 'value', { set: function(val) { this.anothervalue = val; } }); o.value = 5; console.log(o.value); //
undefined console.log(o.anothervalue); // 5 specifications specification ecmascript (ecma-262)the definition...
Object.prototype.constructor - JavaScript
*/ } function createdconstructor() { parent.call(this) } createdconstructor.prototype = object.create(parent.prototype) createdconstructor.prototype.create = function create() { return new this.constructor() } new createdconstructor().create().create() // typeerror
undefined is not a function since constructor === parent in the example above the exception will be shown since the constructor links to parent.
...osition } function child(x, y) { this.position = { x: x, y: y } } child = object.assign(parentwithstatic) child.prototype = object.create(parentwithstatic.prototype) child.prototype.constructor = child child.prototype.getoffsetbyinitialposition = function getoffsetbyinitialposition() { let position = this.position let startposition = this.constructor.getstartposition() // error
undefined is not a function, since the constructor is child return { offsetx: startposition.x - position.x, offsety: startposition.y - position.y } }; for this example we need either to stay parent constructor to continue to work properly or reassign static properties to child's constructor: ...
Object.getOwnPropertyDescriptors() - JavaScript
get a function which serves as a getter for the property, or
undefined if there is no getter (accessor descriptors only).
... set a function which serves as a setter for the property, or
undefined if there is no setter (accessor descriptors only).
Object.prototype.hasOwnProperty() - JavaScript
note hasownproperty returns true even if the value of the property is null or
undefined.
... o = new object(); o.propone = null; o.hasownproperty('propone'); // returns true o.proptwo =
undefined; o.hasownproperty('proptwo'); // returns true examples using hasownproperty to test for a property's existence the following example determines whether the o object contains a property named prop: o = new object(); o.hasownproperty('prop'); // returns false o.prop = 'exists'; o.hasownproperty('prop'); // returns true direct vs.
Object.prototype.toString() - JavaScript
the following code illustrates this: const o = new object(); o.tostring(); // returns [object object] note: starting in javascript 1.8.5, tostring() called on null returns [object null], and
undefined returns [object
undefined], as defined in the 5th edition of ecmascript and subsequent errata.
... const tostring = object.prototype.tostring; tostring.call(new date); // [object date] tostring.call(new string); // [object string] tostring.call(math); // [object math] // since javascript 1.8.5 tostring.call(
undefined); // [object
undefined] tostring.call(null); // [object null] using tostring() in this way is unreliable; objects can change the behavior of object.prototype.tostring() by defining a symbol.tostringtag property, leading to unexpected results.
Promise.prototype.finally() - JavaScript
so for example: unlike promise.resolve(2).then(() => {}, () => {}) (which will be resolved with
undefined), promise.resolve(2).finally(() => {}) will be resolved with 2.
... similarly, unlike promise.reject(3).then(() => {}, () => {}) (which will be fulfilled with
undefined), promise.reject(3).finally(() => {}) will be rejected with 3.
Comparing Reflect and Object methods - JavaScript
getownpropertydescriptor() object.getownpropertydescriptor() returns a property descriptor of the given property if it exists on the object argument passed in, and returns
undefined if it does not exist.
...returns
undefined if it does not exist, and a typeerror if anything other than an object (a primitive) is passed in as the first argument.
Reflect.apply() - JavaScript
function.prototype.apply.call(math.floor,
undefined, [1.75]); with reflect.apply() this becomes less verbose and easier to understand.
... examples using reflect.apply() reflect.apply(math.floor,
undefined, [1.75]); // 1; reflect.apply(string.fromcharcode,
undefined, [104, 101, 108, 108, 111]) // "hello" reflect.apply(regexp.prototype.exec, /ab/, ['confabulation']).index // 4 reflect.apply(''.charat, 'ponies', [3]) // "i" specifications specification ecmascript (ecma-262)the definition of 'reflect.apply' in that specification.
Reflect.construct() - JavaScript
when using object.create() and function.prototype.apply(), the new.target operator will point to
undefined within the function used as the constructor, since the new keyword is not being used to create the object.
...} let obj3 = object.create(otherclass.prototype); oneclass.apply(obj3, args) // output: // oneclass //
undefined examples using reflect.construct() let d = reflect.construct(date, [1776, 6, 4]) d instanceof date // true d.getfullyear() // 1776 specifications specification ecmascript (ecma-262)the definition of 'reflect.construct' in that specification.
Reflect.set() - JavaScript
reflect.set(arr, 'length', 1) // true arr // ["duck"] // with just one argument, propertykey and value are "
undefined".
... let obj = {} reflect.set(obj) // true reflect.getownpropertydescriptor(obj, '
undefined') // { value:
undefined, writable: true, enumerable: true, configurable: true } specifications specification ecmascript (ecma-262)the definition of 'reflect.set' in that specification.
String.prototype.split() - JavaScript
if separator is a regular expression with capturing parentheses, then each time separator matches, the results (including any
undefined results) of the capturing parentheses are spliced into the output array.
... the original string is: "oh brave new world that has such people in it." the separator is: "
undefined" the array has 1 elements: oh brave new world that has such people in it.
Symbol.keyFor() - JavaScript
return value a string representing the key for the given symbol if one is found on the global registry; otherwise,
undefined.
... examples using keyfor var globalsym = symbol.for('foo'); // create a new global symbol symbol.keyfor(globalsym); // "foo" var localsym = symbol(); symbol.keyfor(localsym); //
undefined // well-known symbols are not symbols registered // in the global symbol registry symbol.keyfor(symbol.iterator) //
undefined specifications specification ecmascript (ecma-262)the definition of 'symbol.keyfor' in that specification.
TypedArray.prototype.map() - JavaScript
mapfn is invoked only for indexes of the typed array which have assigned values; it is not invoked for indexes that are
undefined, those which have been deleted, or which have never been assigned values.
...otherwise, the value
undefined will be passed for use as its this value.
TypedArray - JavaScript
typedarray.prototype.find() returns the found value in the array, if an element in the array satisfies the provided testing function, or
undefined if not found.
... // setting and getting using standard array syntax var int16 = new int16array(2); int16[0] = 42; console.log(int16[0]); // 42 // indexed properties on prototypes are not consulted (fx 25) int8array.prototype[20] = 'foo'; (new int8array(32))[20]; // 0 // even when out of bound int8array.prototype[20] = 'foo'; (new int8array(8))[20]; //
undefined // or with negative integers int8array.prototype[-1] = 'foo'; (new int8array(8))[-1]; //
undefined // named properties are allowed, though (fx 30) int8array.prototype.foo = 'bar'; (new int8array(32)).foo; // "bar" specifications specification ecmascript (ecma-262)the definition of 'typedarray objects' in that specification.
WeakRef.prototype.deref() - JavaScript
the deref method returns the weakref instance's target object, or
undefined if the target object has been garbage-collected.
... syntax obj = ref.deref(); return value the target object of the weakref, or
undefined if the object has been garbage-collected.
globalThis - JavaScript
the this keyword could be used inside functions running in non–strict mode, but this will be
undefined in modules and inside functions running in strict mode.
...however, this causes csp violations in some settings, so es6-shim uses a check like this, for example: var getglobal = function () { if (typeof self !== '
undefined') { return self; } if (typeof window !== '
undefined') { return window; } if (typeof global !== '
undefined') { return global; } throw new error('unable to locate global object'); }; var globals = getglobal(); if (typeof globals.settimeout !== 'function') { // no settimeout in this environment!
isNaN() - JavaScript
origin of nan values nan values are generated when arithmetic operations result in
undefined or unrepresentable values.
... a polyfill for isnan would be (the polyfill leverages the unique never-equal-to-itself characteristic of nan): var isnan = function(value) { var n = number(value); return n !== n; }; examples isnan(nan); // true isnan(
undefined); // true isnan({}); // true isnan(true); // false isnan(null); // false isnan(37); // false // strings isnan('37'); // false: "37" is converted to the number 37 which is not nan isnan('37.37'); // false: "37.37" is converted to the number 37.37 which is not nan isnan("37,5"); // true isnan('123abc'); // true: parseint("123abc") is 123 but number("123abc") is...
parseInt() - JavaScript
if radix is
undefined, 0, or unspecified, javascript assumes the following: if the input string begins with "0x" or "0x" (a zero, followed by lowercase or uppercase x), radix is assumed to be 16 and the rest of the string is parsed as a hexidecimal number.
...if radix is
undefined or 0, it is assumed to be 10 except when the number begins with the character pairs 0x or 0x, in which case a radix of 16 is assumed.
Iteration protocols - JavaScript
if a non-object value gets returned (such as false or
undefined), a typeerror ("iterator.next() returned a non-object value") will be thrown.
...e.log(typeof somestring[symbol.iterator]); // "function" string's default iterator returns the string's code points one by one: let iterator = somestring[symbol.iterator](); console.log(iterator + ''); // "[object string iterator]" console.log(iterator.next()); // { value: "h", done: false } console.log(iterator.next()); // { value: "i", done: false } console.log(iterator.next()); // { value:
undefined, done: true } some built-in constructs—such as the spread syntax—use the same iteration protocol under the hood: console.log([...somestring]); // ["h", "i"] you can redefine the iteration behavior by supplying our own @@iterator: // need to construct a string object explicitly to avoid auto-boxing let somestring = new string('hi'); somestring[symbol.iterator] = function () { return { ...
Equality (==) - JavaScript
if one operand is null and the other is
undefined, return true.
... examples comparison with no type conversion 1 == 1; // true "hello" == "hello"; // true comparison with type conversion "1" == 1; // true 1 == "1"; // true 0 == false; // true 0 == null; // false 0 ==
undefined; // false 0 == !!null; // true, look at logical not operator 0 == !!
undefined; // true, look at logical not operator null ==
undefined; // true const number1 = new number(3); const number2 = new number(3); number1 == 3; // true number1 == number2; // false comparison of objects const object1 = {"key": "value"} const object2 = {"key": "value"}; object1 == object...
Less than (<) - JavaScript
undefined is converted to nan.
...ole.log(5 < "hello"); // false console.log("5" < 3n); // false console.log("3" < 5n); // true number to number comparison console.log(5 < 3); // false console.log(3 < 3); // false console.log(3 < 5); // true number to bigint comparison console.log(5n < 3); // false console.log(3 < 5n); // true comparing boolean, null,
undefined, nan console.log(true < false); // false console.log(false < true); // true console.log(0 < true); // true console.log(true < 1); // false console.log(null < 0); // false console.log(null < 1); // true console.log(
undefined < 3); // false console.log(3 <
undefined); // false console.log(3 < nan); // false console.log(nan < 3); /...
Logical OR (||) - JavaScript
examples of expressions that can be converted to false are: null; nan; 0; empty string ("" or '' or ``);
undefined.
...if you only need to filter out null or
undefined, consider using the nullish coalescing operator.
Strict equality (===) - JavaScript
if both operands are null or both operands are
undefined, return true.
... === "hola"); // false console.log(3 === 3); // true console.log(3 === 4); // false console.log(true === true); // true console.log(true === false); // false console.log(null === null); // true comparing operands of different types console.log("3" === 3); // false console.log(true === 1); // false console.log(null ===
undefined); // false comparing objects const object1 = { name: "hello" } const object2 = { name: "hello" } console.log(object1 === object2); // false console.log(object1 === object1); // true specifications specification ecmascript (ecma-262)the definition of 'equality operators' in that specification.
yield* - JavaScript
n* g2() { yield 1; yield* g1(); yield 5; } const iterator = g2(); console.log(iterator.next()); // {value: 1, done: false} console.log(iterator.next()); // {value: 2, done: false} console.log(iterator.next()); // {value: 3, done: false} console.log(iterator.next()); // {value: 4, done: false} console.log(iterator.next()); // {value: 5, done: false} console.log(iterator.next()); // {value:
undefined, done: true} other iterable objects besides generator objects, yield* can also yield other kinds of iterables (e.g., arrays, strings, or arguments objects).
...= g3(5, 6); console.log(iterator.next()); // {value: 1, done: false} console.log(iterator.next()); // {value: 2, done: false} console.log(iterator.next()); // {value: "3", done: false} console.log(iterator.next()); // {value: "4", done: false} console.log(iterator.next()); // {value: 5, done: false} console.log(iterator.next()); // {value: 6, done: false} console.log(iterator.next()); // {value:
undefined, done: true} the value of yield* expression itself yield* is an expression, not a statement—so it evaluates to a value.
async function - JavaScript
for example: async function foo() { await 1 } ...is equivalent to: function foo() { return promise.resolve(1).then(() =>
undefined) } code after each await expression can be thought of as existing in a .then callback.
...the default return value of
undefined is returned as the resolution value of the current promise.
return - JavaScript
if omitted,
undefined is returned instead.
... function square(x) { return x * x; } var demo = square(3); // demo will equal 9 if the value is omitted,
undefined is returned instead.
Transitioning to strict mode - JavaScript
in strict mode, it is now
undefined.
... when a function was called with call or apply, if the value was a primitive value, this one was boxed into an object (or the global object for
undefined and null).
Classes and Inheritance - Archive of obsolete content
however, since the value of this is
undefined for ordinary function calls, we need to add some boilerplate code to convert them to constructor calls: function shape(x, y) { if (!this) return new shape(x, y); this.x = x; this.y = y; } prototypes every object has an implicit property, known as its prototype.
Modules - Archive of obsolete content
if the script being loaded is less privileged than the loading script, the access is prevented, as the following example shows: // index.js: let a = loadscript("www.foo.com/a.js", { components: components }); // index.js has chrome privileges components.utils; // => [object nsxpccomponents_utils] // a.js: // a.js has content privileges imports.components.utils; // =>
undefined modules in the add-on sdk the module system used by the sdk is based on what we learned so far: it follows the commonjs specification, which attempts to define a standardized module api.
simple-storage - Archive of obsolete content
"./read.png", onclick: function() { console.log(ss.storage.value); } }); require("sdk/ui/button/action").actionbutton({ id: "delete", label: "delete", icon: "./delete.png", onclick: function() { delete ss.storage.value; console.log("deleting value"); } }); if you run it, you'll see that after clicking "read" after clicking "delete" gives you the expected output: info:
undefined note that to run this add-on you'll have to save icon files named "write.png", "read.png", and "delete.png" to the add-on's "data" directory.
ui/button/action - Archive of obsolete content
for example: button.state("tab", { "label" : "tab-specific label", "icon": "./tab-specific-icon.ico" }); to reset state, pass null: button.state("tab", null); returns state : if you have passed the second state argument to make this function a setter, it returns
undefined.
ui/button/toggle - Archive of obsolete content
for example: button.state("tab", { "label" : "tab-specific label", "icon": "./tab-specific-icon.ico" }); to reset state, pass null: button.state("tab", null); returns state : if you have passed the second state argument to make this function a setter, it returns
undefined.
Canvas code snippets - Archive of obsolete content
method] = function() { this.ctx[method].apply(this.ctx, arguments); return this; }; } for (let m of gettermethods) { let method = m; canvas2dcontext.prototype[method] = function() { return this.ctx[method].apply(this.ctx, arguments); }; } for (let p of props) { let prop = p; canvas2dcontext.prototype[prop] = function(value) { if (value ===
undefined) return this.ctx[prop]; this.ctx[prop] = value; return this; }; } }; var canvas = document.getelementbyid('canvas'); // use context to get access to underlying context var ctx = canvas2dcontext(canvas) .strokestyle('rgb(30, 110, 210)') .transform(10, 3, 4, 5, 1, 0) .strokerect(2, 10, 15, 20) .context; // use property name as a function (but without arguments) ...
Finding window handles - Archive of obsolete content
gdkwindow.ptr(ctypes.uint64(gdkwindowptrstring)); var rez_gst = gdk_x11_get_server_time(browserwindow_madeintogdkwinptr); console.info('rez_gst:', rez_gst, uneval(rez_gst)); // return is a number of ms since the computer (xserver) was on var rez_gwf = gdk_window_focus(browserwindow_madeintogdkwinptr, rez_gst); console.info('rez_gwf:', rez_gwf, uneval(rez_gwf)); // return is void so this will be
undefined gdk.close(); gtk+ components.utils.import('resource://gre/modules/services.jsm'); var browserwindow = services.wm.getmostrecentwindow('navigator:browser'); if (!browserwindow) { throw new error('no browser window found'); } var basewindow = browserwindow.queryinterface(ci.nsiinterfacerequestor) .getinterface(ci.nsiwebnavigation) ...
Preferences - Archive of obsolete content
e(in string aprefname, in nsiidref atype, [iid_is(atype), retval] out nsqiresult avalue); void setcomplexvalue(in string aprefname, in nsiidref atype, in nsisupports avalue); as you can see, both of them take a parameter, atype, which can have one of the following values (to be precise, you should pass components.interfaces.nsiwhatever instead of just nsiwhatever, which is
undefined).
How to convert an overlay extension to restartless - Archive of obsolete content
here are some functions to handle this: function getgenericpref(branch,prefname) { switch (branch.getpreftype(prefname)) { default: case 0: return
undefined; // pref_invalid case 32: return getucharpref(prefname,branch); // pref_string case 64: return branch.getintpref(prefname); // pref_int case 128: return branch.getboolpref(prefname); // pref_bool } } function setgenericpref(branch,prefname,prefvalue) { switch (typeof prefvalue) { case "string": setucharpref(prefname,...
Installing Extensions and Themes From Web Pages - Archive of obsolete content
web script example <script type="application/javascript"> <!-- function install (aevent) { for (var a = aevent.target; a.href ===
undefined;) a = a.parentnode; var params = { "foo": { url: aevent.target.href, iconurl: aevent.target.getattribute("iconurl"), hash: aevent.target.getattribute("hash"), tostring: function () { return this.url; } } }; installtrigger.install(params); return false; } //--> </script> <a href="http://www.example.com/foo.xpi" iconurl="http://www.example.
JavaScript crypto - Archive of obsolete content
if (typeof(crypto.version) != "
undefined") { crmfobject = crypto.generatecrmfrequest( "cn=" + form.name.value, form.password.value, authenticator, keytransportcert, "setcrmfrequest();", 1024, null, "rsa-dual-use"); } return false; } function setcrmfrequest() { form.cert_request.value = crmfobject.request; form.submit(); } form.onsubmit = validate; </script> on completion of...
Cmdline tests - Archive of obsolete content
e: use case 1: test the interactive cmdline debugger test contents: start avmshell -d test.abc, set breakpoint on a line, show local variable value, quit from cmdutils import * def run(): r=runtestlib() r.run_test( 'debugger locals', '%s -d testdata/debug.abc'%r.avmrd, input='break 53\ncontinue\nnext\ninfo locals\nnext\ninfo locals\nquit\n', expectedout=['local1 =
undefined','local2 = 10','local2 = 15'] ) use case 2: test -memstats returns memory logs to stdout test contents: start avmshell -memstats test.abc, assert stdout contains 'gross stats', 'sweep m reclaimed n pages.' from cmdutils import * def run(): r=runtestlib() r.run_test(name='memstats', command="%s -memstats testdata/memstats.abc" % r.avm, expectedout=[ ...
Tree Box Objects - Archive of obsolete content
var x = {}, y = {}, width = {}, height = {}; if (typeof tree.columns != "
undefined") column = tree.columns[column]; tree.boxobject.getcoordsforcellitem( row, column, part, x, y, width, height ); the row, column, and part arguments are similar to those returned from the getcellat() function.
listbox - Archive of obsolete content
(or, on some platforms, typeof(listboxcurrentindex) will be
undefined) in a single selection list, the current index will always be the same as the selected index.
richlistbox - Archive of obsolete content
(or, on some platforms, typeof(listboxcurrentindex) will be
undefined) in a single selection list, the current index will always be the same as the selected index.
NPVariant - Archive of obsolete content
javascript type to npvarianttype enumeration mapping when using npvariants to access javascript objects in the browser, or vise versa, the mapping of javascript values to npvariants is as follows: javascript type npvarianttype
undefined npvarianttype_void null npvarianttype_null boolean npvarianttype_bool number npvarianttype_int32 or npvarianttype_double string npvarianttype_string all other types npvarianttype_object functions npn_releasevariantvalue() npn_getstringidentifier() npn_getstringide...
Browser Feature Detection - Archive of obsolete content
alse}, {name: 'voicefamily', 'supported': false}, {name: 'volume', 'supported': false}, {name: 'widows', 'supported': false}, {name: 'zindex', 'supported': false} ] }; function supports(object, featureset) { var i; var features = _features[featureset]; var level = 0; if (!features) return level; for (i = 0; i < features.length; i++) if (typeof(object[features[i].name]) != '
undefined') { features[i].supported = true; ++level; } return math.floor( (100 * level) / features.length ); } function generatereport(object, featureset, description) { var i; var features = _features[featureset]; document.write('<p><b>' + featureset + ' support for properties/methods in ' + description + ', percentage of names defined = ' + supports(object, featureset) + '%<\/b><\/p>');...
E4X for templating - Archive of obsolete content
createbundle('chrome://myeext/locale/myext.properties'); if (args){ args = array.prototype.slice.call(arguments, 1); return strs.formatstringfromname(msg,args,args.length); } return strs.getstringfromname(msg); } for example, <toolbarbutton label={$s('mytoolbar.label')}/> conditionals function _if (cond, h, _else) { if (cond && cond !=
undefined) { // we need
undefined condition for e4x return h(cond); } else if (_else) { return _else(cond); } return ''; // empty string allows conditions in attribute as well as element content } for example: {_if(elems.length(), function () <description>{elems[0]}</description>, function _else () <label>no data</label> )} note that the simple xmllist() constru...
Processing XML with E4X - Archive of obsolete content
function xmlchildwalker (xml) { var i = 0; var child = xml.*[0]; while (child !=
undefined) { yield child; child = xml.*[++i]; } yield false; } var a = <a><b/><c/></a>; var xcw = xmlchildwalker(a); var child; while ((child = xcw.next()) !== false) { alert(child.toxmlstring()); // "<b/>" then "<c/>" } see also e4x e4x tutorial ...
Error.description - Archive of obsolete content
try { // cause an error: x = y } catch(e) { // prints "[object error]": document.write(e) document.write (" "); // prints 5009: document.write((e.number & 0xffff)) document.write (" "); // prints "'y' is
undefined": document.write(e.description); document.write (" "); // prints "'y' is
undefined": document.write(e.message) } requirements supported in the following document modes: quirks, internet explorer 6 standards, internet explorer 7 standards, internet explorer 8 standards, internet explorer 9 standards, internet explorer 10 standards, internet explorer 11 standards.
Error.number - Archive of obsolete content
error code: 5009 facility code: 10 error message: 'y' is
undefined requirements supported in the following document modes: quirks, internet explorer 6 standards, internet explorer 7 standards, internet explorer 8 standards, internet explorer 9 standards, internet explorer 10 standards, internet explorer 11 standards.
New in JavaScript 1.3 - Archive of obsolete content
--> new features in javascript 1.3 new globals nan infinity
undefined new methods isfinite() function.prototype.call() function.prototype.apply() date.utc() date.prototype.getfullyear() date.prototype.setfullyear() date.prototype.getmilliseconds() date.prototype.setmilliseconds() date.prototype.getutcfullyear() date.prototype.getutcmonth() date.prototype.getutcdate() date.prototype.getutchours() date.prototype.getutcminutes() date.prototype.getutc...
MDN Web Docs Glossary: Definitions of Web-related terms
three js time to first byte time to interactive tld tofu transmission control protocol (tcp) transport layer security (tls) tree shaking trident truthy ttl turn type type coercion type conversion u udp (user datagram protocol) ui
undefined unicode uri url urn usenet user agent utf-8 ux v validator value variable vendor prefix viewport visual viewport voip w w3c wai wcag web performance web server web standards ...
Introducing asynchronous JavaScript - Learn web development
' + image.src + 'displayed.'); you should now get an error in your console instead of the third message: typeerror: image is
undefined; can't access its "src" property this is because at the time the browser tries to run the third console.log() statement, the fetch() block has not finished running so the image variable has not been given a value.
Looping code - Learn web development
cats.length returns 5, as there are 5 items in the array, but we don't want to get up to i = 5, as that would return
undefined for the last item (there is no array item with an index of 5).
Making decisions in your code — conditionals - Learn web development
any value that is not false,
undefined, null, 0, nan, or an empty string ('') actually returns true when tested as a conditional statement, therefore you can simply use a variable name on its own to test whether it is true, or even that it exists (that is, it is not
undefined.) so for example: let cheese = 'cheddar'; if (cheese) { console.log('yay!
What is JavaScript? - Learn web development
if you swapped the order of the first two lines of code, it would no longer work — instead, you'd get an error returned in the browser developer console — typeerror: para is
undefined.
Implementing feature detection - Learn web development
give it the following contents: const conditional = document.queryselector('.conditional'); const testelem = document.createelement('div'); if (testelem.style.flex !==
undefined && testelem.style.flexflow !==
undefined) { conditional.setattribute('href', 'flex-layout.css'); } else { conditional.setattribute('href', 'float-layout.css'); } here we are grabbing a reference to the second <link> element, and creating a <div> element as part of our test.
Accessibility API cross-reference
<h> is also available but its use is not recommended because of lack of suitable tools - and the heading level is
undefined click on this thing and then click on the item for tooltip style help helpballoon n/a n/a n/a editable field that allows user to assign a key combination hotkeyfield n/a n/a n/a graphic that indicates something, such as an arrow indicator n/a n/a n/a abstract role - a generi...
Error codes returned by Mozilla APIs
_error_dom_not_number_err (0x805303ed) ns_error_dom_not_boolean_err (0x805303ee) ns_error_dom_not_function_err (0x805303ef) ns_error_dom_too_few_parameters_err (0x805303f0) ns_error_dom_bad_document_domain (0x805303f1) ns_error_dom_prop_access_denied (0x805303f2) ns_error_dom_xpconnect_access_denied (0x805303f3) ns_error_dom_bad_uri (0x805303f4) ns_error_dom_retval_
undefined (0x805303f5) ns_error_dom_quota_reached (0x805303f6) an attempt was made to add data into the local or global storage for a given domain that would exceed the amount allowed for that domain.
IPDL Tutorial
maybe types if you want to pass a potentially
undefined argument, you can add ?
AddonType
if
undefined the type will not appear in the ui.
Downloads.jsm
promise resolves to
undefined when the download has finished successfully and you can access the target file.
Task.jsm
for (let i = 0; i < 3; i++) { result += yield getpromiseresolvedontimeoutwithvalue(50, "!"); } return "resolution result for the task: " + result; }).then(function (result) { // result == "resolution result for the task: value!!!" // the result is
undefined if no special task.result exception was thrown.
Extras
other renderers are expected to ignore attributes that they don't understand while the behavior of
undefined elements is well,
undefined.
MathML3Testsuite
this exception also holds for obsolete features (such as macro, mode etc) or for other
undefined behaviors (attribute href for example).
Localization Use Cases
first, there is devicestoragehelper.showformatedsize (sic): function showformatedsize(element, l10nid, size) { if (size ===
undefined || isnan(size)) { element.textcontent = ''; return; } // kb - 3 kb (nearest ones), mb, gb - 1.2 mb (nearest tenth) var fixeddigits = (size < 1024 * 1024) ?
AsyncTestUtils extended framework
a function that does not return anything (or returns
undefined) and is not a generator is treated like a function that returned true.
JS_GetReservedSlot
they cannot be returned from functions, set as properties on objects, embedded in javascript arrays, and so on.) new objects' reserved slots are initialized to
undefined.
JS_GetTypeName
the following table lists jstypes and the string literals reported by js_gettypename: type literal jstype_void "
undefined" jstype_object "object" jstype_function "function" jstype_string "string" jstype_number "number" jstype_boolean "boolean" any other value null see also js_convertvalue js_typeofvalue js_valuetoboolean js_valuetofunction js_valuetoint32 js_valuetonumber js_valuetoobject js_valuetostring bug 1037718 ...
JS_HasArrayLength
on failure, js_hasarraylength returns js_false, and the value left in *lengthp is
undefined.
JS_HasElement
if the search fails with an error or exception, js_haselement returns false, and the value left in *foundp is
undefined.
JS_HasInstance
on error or exception, it returns false, and the value left in *bp is
undefined.
JS_HasOwnProperty
if an error occurs during the search, the function returns false, and the value of *foundp is
undefined.
JS_HasProperty
if an error occurs during the search, the function returns false, and the value of *foundp is
undefined.
JS_InitStandardClasses
these include all the standard ecmascript global properties defined in ecma 262-3 §15.1: array, boolean, date, decodeuri, decodeuricomponent, encodeuri, encodeuricomponent, error, eval, evalerror, function, infinity, isnan, isfinite, math, nan, number, object, parseint, parsefloat, rangeerror, referenceerror, regexp, string, syntaxerror, typeerror,
undefined, and urierror as well as a few spidermonkey-specific globals, depending on compile-time options: escape, unescape, uneval, internalerror, script, xml, namespace, qname, file, generator, iterator, and stopiteration, as of spidermonkey 1.7.
JS_IsExtensible
if successful, js_isextensible stores [[extensible]] property to *extensible and returns true, otherwise returns false and the value of *extensible is
undefined.
JS_IsIdentifier
on successful, js_isidentifier stores the test result to *isidentifier and returns true, otherwise returns false and the value of *isidentifier is
undefined.
JS_NewDouble
modifying a jsdouble allocated with this function can cause
undefined behavior.
JS_NewObject
js_newobjectwithgivenproto: if this is null, the new object has no prototype; its __proto__ property is
undefined.
JS_NextProperty
on error, it returns false, and the value left in *idp is
undefined.
JS_ParseJSON
if an error occurs, the value left in *vp is
undefined.
Web Console remoting - Firefox Developer Tools
localhost/~mihai/mozilla/test.html", "linenumber": 149, "functionname": "", "timestamp": 1347302713771, "private": false, "arguments": [ "error omg aloha ", { "type": "object", "classname": "htmlbodyelement", "actor": "conn0.consoleobj20" }, " 960 739 3.141592653589793 %a", "zuzu", { "type": "null" }, { "type": "
undefined" } ] } } similar to how we send the page errors, here we send the actual console event received from the nsiobserverservice.
Animation.play() - Web APIs
return value
undefined example in the growing/shrinking alice game example, clicking or tapping the cake causes alice's growing animation (alicechange) to play forward, causing her to get bigger, as well as triggering the cake's animation.
Animation.reverse() - Web APIs
return value
undefined example in the growing/shrinking alice game example, clicking or tapping the bottle causes alice's growing animation (alicechange) to play backwards, causing her to get smaller.
AudioNode.disconnect() - Web APIs
syntax audionode.disconnect(); audionode.disconnect(output); audionode.disconnect(destination); audionode.disconnect(destination, output); audionode.disconnect(destination, output, input); return value
undefined parameters there are several versions of the disconnect() method, which accept different combinations of parameters to control which nodes to disconnect from.
AudioScheduledSourceNode.start() - Web APIs
if no value is passed then the duration will be equal to the length of the audio buffer minus the offset value return value
undefined exceptions invalidstatenode the node has already been started.
Background Tasks API - Web APIs
window.requestidlecallback = window.requestidlecallback || function(handler) { let starttime = date.now(); return settimeout(function() { handler({ didtimeout: false, timeremaining: function() { return math.max(0, 50.0 - (date.now() - starttime)); } }); }, 1); } if window.requestidlecallback is
undefined, we create it here.
Navigator.onLine - Web APIs
to check if you are online, query window.navigator.online, as in the following example: if (navigator.online) { console.log('online'); } else { console.log('offline'); } if the browser doesn't support navigator.online the above example will always come out as false/
undefined.
NavigatorPlugins.mimeTypes - Web APIs
example function isjavapresent() { return 'application/x-java-applet' in navigator.mimetypes; } function getjavaplugindescription() { var mimetype = navigator.mimetypes['application/x-java-applet']; if (mimetype ===
undefined) { // no java plugin present return
undefined; } return mimetype.enabledplugin.description; } specifications specification status comment html living standardthe definition of 'navigatorplugins.mimetypes' in that specification.
NavigatorPlugins.plugins - Web APIs
function getflashversion() { var flash = navigator.plugins.nameditem('shockwave flash'); if (typeof flash != 'object') { // flash is not present return
undefined; } if(flash.version){ return flash.version; } else { //no version property (e.g.
Node.insertBefore() - Web APIs
node to insert let newnode = document.createelement("span") // get a reference to the parent node let parentdiv = document.getelementbyid("childelement").parentnode // begin test case [ 1 ] : existing childelement (all works correctly) let sp2 = document.getelementbyid("childelement") parentdiv.insertbefore(newnode, sp2) // end test case [ 1 ] // begin test case [ 2 ] : childelement is of type
undefined let sp2 =
undefined // non-existent node of id "childelement" parentdiv.insertbefore(newnode, sp2) // implicit dynamic cast to type node // end test case [ 2 ] // begin test case [ 3 ] : childelement is of type "
undefined" ( string ) let sp2 = "
undefined" // non-existent node of id "childelement" parentdiv.insertbefore(newnode, sp2) // generates "type error: invalid argument" // end test case [ ...
Node.nodeName - Web APIs
bear in mind, however, that nodename will return "#text" for text nodes while tagname will return
undefined.
NodeList - Web APIs
an alternative to accessing nodelist[i] (which instead returns
undefined when i is out-of-bounds).
NonDocumentTypeChildNode.nextElementSibling - Web APIs
on (item) { if (item.hasownproperty('nextelementsibling')) { return; } object.defineproperty(item, 'nextelementsibling', { configurable: true, enumerable: true, get: function () { var el = this; while (el = el.nextsibling) { if (el.nodetype === 1) { return el; } } return null; }, set:
undefined }); }); })([element.prototype, characterdata.prototype]); specifications specification status comment domthe definition of 'childnodenextelementsibling' in that specification.
NonDocumentTypeChildNode.previousElementSibling - Web APIs
{ if (item.hasownproperty('previouselementsibling')) { return; } object.defineproperty(item, 'previouselementsibling', { configurable: true, enumerable: true, get: function () { let el = this; while (el = el.previoussibling) { if (el.nodetype === 1) { return el; } } return null; }, set:
undefined }); }); })([element.prototype, characterdata.prototype]); specifications specification status comment domthe definition of 'nondocumenttypechildnode.previouselementsibling' in that specification.
OrientationSensor.populateMatrix() - Web APIs
parameters targetmatrix tbd return value
undefined example // tbd specifications specification status comment orientation sensorthe definition of 'populatematrix' in that specification.
ParentNode.append() - Web APIs
syntax // [throws, unscopable] parentnode.append(...nodesordomstrings) // returns
undefined parameters nodes a set of node or domstring objects to insert.
ParentNode.replaceChildren() - Web APIs
syntax // [throws, unscopable] parentnode.replacechildren(...nodesordomstrings) // returns
undefined parameters nodesordomstrings a set of node or domstring objects to replace the parentnode's existing children with.
TransformStream - Web APIs
controller.enqueue(new uint8array(chunk)) else if ('function' === typeof chunk.valueof && chunk.valueof() !== chunk) this.transform(chunk.valueof(), controller) // hack else if ('tojson' in chunk) this.transform(json.stringify(chunk), controller) break case 'symbol': controller.error("cannot send a symbol as a chunk part") break case '
undefined': controller.error("cannot send
undefined as a chunk part") default: controller.enqueue(this.textencoder.encode(string(chunk))) break }, flush() { /* do any destructor work here */ } } class anytou8stream extends transformstream { constructor() { super({...transformcontent, textencoder: new textencoder()}) } } polyfilling textencoderstream and textdeco...
USBEndpoint - Web APIs
let inendpoint =
undefined; let outendpoint =
undefined; for (const interface of device.configuration.interfaces) { // only support devices with out multiple alternate interfaces.
Signaling and video calling - Web APIs
this involves a change near the end of the "connection" message handler: if (sendtoclients) { var msgstring = json.stringify(msg); var i; if (msg.target && msg.target !==
undefined && msg.target.length !== 0) { sendtooneuser(msg.target, msgstring); } else { for (i=0; i<connectionarray.length; i++) { connectionarray[i].send(msgstring); } } } this code now looks at the pending message to see if it has a target property.
Using DTMF with WebRTC - Web APIs
function connectanddial() { callerpc = new rtcpeerconnection(); hasaddtrack = (callerpc.addtrack !==
undefined); callerpc.onicecandidate = handlecallericeevent; callerpc.onnegotiationneeded = handlecallernegotiationneeded; callerpc.oniceconnectionstatechange = handlecallericeconnectionstatechange; callerpc.onsignalingstatechange = handlecallersignalingstatechangeevent; callerpc.onicegatheringstatechange = handlecallergatheringstatechangeevent; receiverpc = new rtcpeerconnection(); receiver...
Using the Web Speech API - Web APIs
populatevoicelist(); if (speechsynthesis.onvoiceschanged !==
undefined) { speechsynthesis.onvoiceschanged = populatevoicelist; } speaking the entered text next, we create an event handler to start speaking the text entered into the text field.
Window.requestAnimationFrame() - Web APIs
const element = document.getelementbyid('some-element-you-want-to-animate'); let start; function step(timestamp) { if (start ===
undefined) start = timestamp; const elapsed = timestamp - start; // `math.min()` is used here to make sure that the element stops at exactly 200px.
Window.requestFileSystem() - Web APIs
return value
undefined example specifications specification status comment file and directory entries api draft draft of proposed api this api has no official w3c or whatwg specification.
Window.scrollY - Web APIs
a fully compatible example: var supportpageoffset = window.pagexoffset !==
undefined; var iscss1compat = ((document.compatmode || "") === "css1compat"); var x = supportpageoffset ?
Window.speechSynthesis - Web APIs
= document.createelement('option'); option.textcontent = voices[i].name + ' (' + voices[i].lang + ')'; if(voices[i].default) { option.textcontent += ' -- default'; } option.setattribute('data-lang', voices[i].lang); option.setattribute('data-name', voices[i].name); voiceselect.appendchild(option); } } populatevoicelist(); if (speechsynthesis.onvoiceschanged !==
undefined) { speechsynthesis.onvoiceschanged = populatevoicelist; } inputform.onsubmit = function(event) { event.preventdefault(); var utterthis = new speechsynthesisutterance(inputtxt.value); var selectedoption = voiceselect.selectedoptions[0].getattribute('data-name'); for(i = 0; i < voices.length ; i++) { if(voices[i].name === selectedoption) { utterthis.voice = voices[i]; } ...
Window - Web APIs
window.event read only returns the current event, which is the event currently being handled by the javascript code's context, or
undefined if no event is currently being handled.
WindowOrWorkerGlobalScope.clearTimeout() - Web APIs
var alarm = { remind: function(amessage) { alert(amessage); this.timeoutid =
undefined; }, setup: function() { if (typeof this.timeoutid === 'number') { this.cancel(); } this.timeoutid = window.settimeout(function(msg) { this.remind(msg); }.bind(this), 1000, 'wake up!'); }, cancel: function() { window.cleartimeout(this.timeoutid); } }; window.onclick = function() { alarm.setup(); }; notes passing an invalid id to cleartimeout() silent...
WorkerGlobalScope.self - Web APIs
example if you called console.log(self); inside a worker, you will get a worker global scope of the same type as that worker object written to the console — something like the following: dedicatedworkerglobalscope {
undefined:
undefined, infinity: infinity, math: mathconstructor, nan: nan, intl: object…} infinity: infinity array: function array() { [native code] } arguments: null caller: null isarray: function isarray() { [native code] } length: 1 name: "array" observe: function observe() { [native code] } prototype: array[0] unobserve: function unobserve() { [...
WritableStreamDefaultWriter.close() - Web APIs
return value a promise, which fulfills with the
undefined if all remaining chunks were successfully written before the close, or rejects with an error if a problem was encountered during the process.
Video player styling basics - Developer guides
showing the video controls when javascript is available to the browser now needs to be set: // display the user defined video controls videocontrols.setattribute('data-state', 'visible'); progress bar support a check also needs to be made to set up the "fake" progress bar if the browser doesn't support the <progress> element: var supportsprogress = (document.createelement('progress').max !==
undefined); if (!supportsprogress) progress.setattribute('data-state', 'fake'); button functionality this section looks at the javascript required for implementing the button functionality.
Mutation events - Developer guides
allback) { var observer = new mutationobserver(function (mutations) { _.foreach(mutations, function (mutation) { _.foreach(mutation.removednodes, function (removed) { if (isdescendant(element, removed)) { callback(); // allow garbage collection observer.disconnect(); observer =
undefined; } }); }); }); observer.observe(document, { childlist: true, subtree: true }); }; usage you can register a listener for mutation events using element.addeventlistener as follows: element.addeventlistener("domnodeinserted", function (event) { // ...
Introduction to HTML5 - Developer guides
until the introduction of html5, only the meaning of valid mark-up was defined, meaning that as soon as one small error was made in the mark-up (most websites have at least one), the behavior was
undefined.
Control flow and error handling - JavaScript
ample, do not write code like this: // prone to being misread as "x == y" if (x = y) { /* statements here */ } if you need to use an assignment in a conditional expression, a common practice is to put additional parentheses around the assignment, like this: if ((x = y)) { /* statements here */ } falsy values the following values evaluate to false (also known as falsy values): false
undefined null 0 nan the empty string ("") all other values—including all objects—evaluate to true when passed to a conditional statement.
Keyed collections - JavaScript
let sayings = new map(); sayings.set('dog', 'woof'); sayings.set('cat', 'meow'); sayings.set('elephant', 'toot'); sayings.size; // 3 sayings.get('dog'); // woof sayings.get('fox'); //
undefined sayings.has('bird'); // false sayings.delete('dog'); sayings.has('dog'); // false for (let [key, value] of sayings) { console.log(key + ' goes ' + value); } // "cat goes meow" // "elephant goes toot" sayings.clear(); sayings.size; // 0 object and map compared traditionally, objects have been used to map strings to values.
Unicode property escapes - JavaScript
// ٢ is the digit 2 in arabic-indic notation // while it is predominantly written within the arabic script // it can also be written in the thaana script "٢".match(/\p{script=thaana}/u); // null as thaana is not the predominant script super() "٢".match(/\p{script_extensions=thaana}/u); // ["٢", index: 0, input: "٢", groups:
undefined] unicode property escapes vs.
TypeError: X.prototype.y called on incompatible type - JavaScript
message typeerror: 'this' is not a set object (edge) typeerror: function.prototype.tostring called on incompatible object (firefox) typeerror: function.prototype.bind called on incompatible target (firefox) typeerror: method set.prototype.add called on incompatible receiver
undefined (chrome) typeerror: bind must be called on a function (chrome) error type typeerror what went wrong?
TypeError: "x" is read-only - JavaScript
the global variable
undefined is also read-only, so you can't silence the infamous "
undefined is not a function" error by doing this: 'use strict';
undefined = function() {}; // typeerror: "
undefined" is read-only valid cases 'use strict'; var obj = object.freeze({name: 'score', points: 157}); obj = {name: obj.name, points: 0}; // replacing it with a new object works 'use strict'; var lung_count = 2; // a `var` works...
TypeError: invalid 'instanceof' operand 'x' - JavaScript
examples instanceof vs typeof "test" instanceof ""; // typeerror: invalid 'instanceof' operand "" 42 instanceof 0; // typeerror: invalid 'instanceof' operand 0 function foo() {} var f = foo(); // foo() is called and returns
undefined var x = new foo(); x instanceof f; // typeerror: invalid 'instanceof' operand f x instanceof x; // typeerror: x is not a function to fix these errors, you will either need to replace the instanceof operator with the typeof operator, or to make sure you use the function name, instead of the result of its evaluation.
JavaScript error reference - JavaScript
be an integerrangeerror: repeat count must be less than infinityrangeerror: repeat count must be non-negativereferenceerror: "x" is not definedreferenceerror: assignment to undeclared variable "x"referenceerror: can't access lexical declaration "x" before initializationreferenceerror: deprecated caller or arguments usagereferenceerror: invalid assignment left-hand sidereferenceerror: reference to
undefined property "x"syntaxerror: "0"-prefixed octal literals and octal escape seq.
The arguments object - JavaScript
ey are passed): function func(a = 55) { arguments[0] = 99; // updating arguments[0] does not also update a console.log(a); } func(10); // 10 and also: function func(a = 55) { a = 99; // updating a does not also update arguments[0] console.log(arguments[0]); } func(10); // 10 and also: // an untracked default parameter function func(a = 55) { console.log(arguments[0]); } func(); //
undefined specifications specification ecmascript (ecma-262)the definition of 'arguments exotic objects' in that specification.
setter - JavaScript
when current is assigned a value, it updates log with that value: const language = { set current(name) { this.log.push(name); }, log: [] } language.current = 'en'; console.log(language.log); // ['en'] language.current = 'fa'; console.log(language.log); // ['en', 'fa'] note that current is not defined, and any attempts to access it will result in
undefined.
Array.prototype.reduceRight() - JavaScript
// production steps of ecma-262, edition 5, 15.4.4.22 // reference: http://es5.github.io/#x15.4.4.22 if ('function' !== typeof array.prototype.reduceright) { array.prototype.reduceright = function(callback /*, initialvalue*/) { 'use strict'; if (null === this || '
undefined' === typeof this) { throw new typeerror('array.prototype.reduce called on null or
undefined'); } if ('function' !== typeof callback) { throw new typeerror(callback + ' is not a function'); } var t = object(this), len = t.length >>> 0, k = len - 1, value; if (arguments.length >= 2) { value = arguments[1]; } else { while (k >= 0 && !(k in t)) { ...
Array.prototype.flat() - JavaScript
t next = stack.pop(); if(array.isarray(next)) { // push back array items, won't modify the original input stack.push(...next); } else { res.push(next); } } // reverse to restore input order return res.reverse(); } const arr = [1, 2, [3, 4, [5, 6]]]; flatten(arr); // [1, 2, 3, 4, 5, 6] use generator function function* flatten(array, depth) { if(depth ===
undefined) { depth = 1; } for(const item of array) { if(array.isarray(item) && depth > 0) { yield* flatten(item, depth - 1); } else { yield item; } } } const arr = [1, 2, [3, 4, [5, 6]]]; const flattened = [...flatten(arr, infinity)]; // [1, 2, 3, 4, 5, 6] please do not add polyfills on this article.
Array.prototype.length - JavaScript
var numbers = [1, 2, 3, 4, 5]; if (numbers.length > 3) { numbers.length = 3; } console.log(numbers); // [1, 2, 3] console.log(numbers.length); // 3 create empty array of fixed length var numbers = []; numbers.length = 3; console.log(numbers); // [
undefined,
undefined,
undefined] specifications specification ecmascript (ecma-262)the definition of 'array.length' in that specification.
Math.abs() - JavaScript
examples behavior of math.abs() passing an empty object, an array with more than one member, a non-numeric string or
undefined/empty variable returns nan.
Math.clz32() - JavaScript
var asuint = x >>> 0; if (asuint === 0) { return 32; } return 31 - (log(asuint) / ln2 | 0) |0; // the "| 0" acts like math.floor }; })(math.log, math.ln2); examples using math.clz32() math.clz32(1); // 31 math.clz32(1000); // 22 math.clz32(); // 32 var stuff = [nan, infinity, -infinity, 0, -0, false, null,
undefined, 'foo', {}, []]; stuff.every(n => math.clz32(n) == 32); // true math.clz32(true); // 31 math.clz32(3.5); // 30 specifications specification ecmascript (ecma-262)the definition of 'math.clz32' in that specification.
NaN - JavaScript
parseint("blabla") or number(
undefined)) math operation where the result is not a real number (e.g.
Number.EPSILON - JavaScript
polyfill if (number.epsilon ===
undefined) { number.epsilon = math.pow(2, -52); } examples testing equality x = 0.2; y = 0.3; z = 0.1; equal = (math.abs(x - y + z) < number.epsilon); specifications specification ecmascript (ecma-262)the definition of 'number.epsilon' in that specification.
Number.isFinite() - JavaScript
polyfill if (number.isfinite ===
undefined) number.isfinite = function(value) { return typeof value === 'number' && isfinite(value); } examples using isfinite number.isfinite(infinity); // false number.isfinite(nan); // false number.isfinite(-infinity); // false number.isfinite(0); // true number.isfinite(2e64); // true number.isfinite('0'); // false, would've been true with ...
Number.isNaN() - JavaScript
these would have been true with global isnan() number.isnan('nan'); // false number.isnan(
undefined); // false number.isnan({}); // false number.isnan('blabla'); // false // these all return false number.isnan(true); number.isnan(null); number.isnan(37); number.isnan('37'); number.isnan('37.37'); number.isnan(''); number.isnan(' '); specifications specification ecmascript (ecma-262)the definition of 'number.isnan' in that specification.
Number.parseFloat() - JavaScript
polyfill if (number.parsefloat ===
undefined) { number.parsefloat = parsefloat; } examples number.parsefloat vs parsefloat this method has the same functionality as the global parsefloat() function: number.parsefloat === parsefloat; // true this method is also part of ecmascript 2015.
Number.parseInt() - JavaScript
polyfill if (number.parseint ===
undefined) { number.parseint = window.parseint } examples number.parseint vs parseint this method has the same functionality as the global parseint() function: number.parseint === parseint // true and is part of ecmascript 2015 (its purpose is modularization of globals).
Number.prototype.toLocaleString() - JavaScript
// the japanese yen doesn't use a minor unit console.log(number.tolocalestring('ja-jp', { style: 'currency', currency: 'jpy' })) // → ¥123,457 // limit to three significant digits console.log(number.tolocalestring('en-in', { maximumsignificantdigits: 3 })); // → 1,23,000 // use the host default language with options for number formatting var num = 30000.65; console.log(num.tolocalestring(
undefined, {minimumfractiondigits: 2, maximumfractiondigits: 2})); // → "30,000.65" where english is the default language, or // → "30.000,65" where german is the default language, or // → "30 000,65" where french is the default language specifications specification ecmascript (ecma-262)the definition of 'number.prototype.tolocalestring' in that specification.
Number - JavaScript
literal syntax 123 // one-hundred twenty-three 123.0 // same 123 === 123.0 // true function syntax number('123') // returns the number 123 number('123') === 123 // true number("unicorn") // nan number(
undefined) // nan constructor number() creates a new number value.
Object.is() - JavaScript
two values are the same if one of the following holds: both
undefined both null both true or both false both strings of the same length with the same characters in the same order both the same object (means both object have same reference) both numbers and both +0 both -0 both nan or both non-zero and both not nan and both have the same value this is not the same as being equal according to the == operator.
Object.prototype.valueOf() - JavaScript
type(4); myobj + 3; // 7 using unary plus +"5" // 5 (string to number) +"" // 0 (string to number) +"1 + 2" // nan (doesn't evaluate) +new date() // same as (new date()).gettime() +"foo" // nan (string to number) +{} // nan +[] // 0 (tostring() returns an empty string list) +[1] // 1 +[1,2] // nan +new set([1]) // nan +bigint(1) // uncaught typeerror: cannot convert a bigint value to a number +
undefined // nan +null // 0 +true // 1 +false // 0 specifications specification ecmascript (ecma-262)the definition of 'object.prototype.valueof' in that specification.
handler.get() - JavaScript
the value reported for a property must be
undefined if the corresponding target object property is a non-configurable own accessor property that has
undefined as its [[get]] attribute.
handler.ownKeys() - JavaScript
const obj = {}; object.defineproperty(obj, 'a', { configurable: false, enumerable: true, value: 10 } ); const p = new proxy(obj, { ownkeys: function(target) { return [123, 12.5, true, false,
undefined, null, {}, []]; } }); console.log(object.getownpropertynames(p)); // typeerror: proxy [[ownpropertykeys]] must return an array // with only string and symbol elements specifications specification ecmascript (ecma-262)the definition of '[[ownpropertykeys]]' in that specification.
handler.set() - JavaScript
cannot set the value of a property if the corresponding target object property is a non-configurable accessor property that has
undefined as its [[set]] attribute.
ReferenceError() constructor - JavaScript
examples catching a referenceerror try { let a =
undefinedvariable } catch (e) { console.log(e instanceof referenceerror) // true console.log(e.message) // "
undefinedvariable is not defined" console.log(e.name) // "referenceerror" console.log(e.filename) // "scratchpad/1" console.log(e.linenumber) // 2 console.log(e.columnnumber) // 6 console.log(e.sta...
ReferenceError - JavaScript
examples catching a referenceerror try { let a =
undefinedvariable } catch (e) { console.log(e instanceof referenceerror) // true console.log(e.message) // "
undefinedvariable is not defined" console.log(e.name) // "referenceerror" console.log(e.filename) // "scratchpad/1" console.log(e.linenumber) // 2 console.log(e.columnnumber) // 6 console.log(e.sta...
Reflect.deleteProperty() - JavaScript
examples using reflect.deleteproperty() let obj = { x: 1, y: 2 } reflect.deleteproperty(obj, 'x') // true obj // { y: 2 } let arr = [1, 2, 3, 4, 5] reflect.deleteproperty(arr, '3') // true arr // [1, 2, 3,
undefined, 5] // returns true if no such property exists reflect.deleteproperty({}, 'foo') // true // returns false if a property is unconfigurable reflect.deleteproperty(object.freeze({foo: 1}), 'foo') // false specifications specification ecmascript (ecma-262)the definition of 'reflect.deleteproperty' in that specification.
Reflect - JavaScript
returns a property descriptor of the given property if it exists on the object,
undefined otherwise.
RegExp.prototype.flags - JavaScript
polyfill if (regexp.prototype.flags ===
undefined) { object.defineproperty(regexp.prototype, 'flags', { configurable: true, get: function() { return this.tostring().match(/[gimsuy]*$/)[0]; } }); } examples using flags /foo/ig.flags; // "gi" /bar/myu.flags; // "muy" specifications specification ecmascript (ecma-262)the definition of 'regexp.prototype.flags' in that specification.
RegExp - JavaScript
0 (reset after match failure) the difference between the sticky flag and the global flag with the sticky flag y, the next match has to happen at the lastindex position, while with the global flag g, the match can happen at the lastindex position or later: re = /\d/y; while (r = re.exec("123 456")) console.log(r, "and re.lastindex", re.lastindex); // [ '1', index: 0, input: '123 456', groups:
undefined ] and re.lastindex 1 // [ '2', index: 1, input: '123 456', groups:
undefined ] and re.lastindex 2 // [ '3', index: 2, input: '123 456', groups:
undefined ] and re.lastindex 3 // ...
String.prototype.endsWith() - JavaScript
however, you can polyfill string.prototype.endswith() with the following snippet: if (!string.prototype.endswith) { string.prototype.endswith = function(search, this_len) { if (this_len ===
undefined || this_len > this.length) { this_len = this.length; } return this.substring(this_len - search.length, this_len) === search; }; } examples using endswith() let str = 'to be, or not to be, that is the question.' console.log(str.endswith('question.')) // true console.log(str.endswith('to be')) // false console.log(str.endswith('to be', 19)) // true specifications sp...
String.prototype.includes() - JavaScript
however, you can easily polyfill this method: if (!string.prototype.includes) { string.prototype.includes = function(search, start) { 'use strict'; if (search instanceof regexp) { throw typeerror('first argument must not be a regexp'); } if (start ===
undefined) { start = 0; } return this.indexof(search, start) !== -1; }; } examples using includes() const str = 'to be, or not to be, that is the question.' console.log(str.includes('to be')) // true console.log(str.includes('question')) // true console.log(str.includes('nonexistent')) // false console.log(str.includes('to be', 1)) // false console.log(str.includes('to be')) ...
String.prototype.localeCompare() - JavaScript
erman, ä has a as the base letter console.log('ä'.localecompare('a', 'de', { sensitivity: 'base' })); // 0 // in swedish, ä and a are separate base letters console.log('ä'.localecompare('a', 'sv', { sensitivity: 'base' })); // a positive value numeric sorting // by default, "2" > "10" console.log("2".localecompare("10")); // 1 // numeric using options: console.log("2".localecompare("10",
undefined, {numeric: true})); // -1 // numeric using locales tag: console.log("2".localecompare("10", "en-u-kn-true")); // -1 specifications specification ecmascript (ecma-262)the definition of 'string.prototype.localecompare' in that specification.
String.prototype.match() - JavaScript
groups an object of named capturing groups whose keys are the names and values are the capturing groups or
undefined if no named capturing groups were defined.
String.prototype.replace() - JavaScript
groups in browser versions supporting named capturing groups, will be an object whose keys are the used group names, and whose values are the matched portions (
undefined if not matched).
String - JavaScript
ng.prototype.fontsize() <font size="size"> string.prototype.italics() <i> string.prototype.link() <a href="url"> (link to url) string.prototype.small() <small> string.prototype.strike() <strike> string.prototype.sub() <sub> string.prototype.sup() <sup> examples string conversion it's possible to use string as a more reliable tostring() alternative, as it works when used on null,
undefined, and on symbols.
Symbol.prototype.description - JavaScript
examples using description symbol('desc').tostring(); // "symbol(desc)" symbol('desc').description; // "desc" symbol('').description; // "" symbol().description; //
undefined // well-known symbols symbol.iterator.tostring(); // "symbol(symbol.iterator)" symbol.iterator.description; // "symbol.iterator" // global symbols symbol.for('foo').tostring(); // "symbol(foo)" symbol.for('foo').description; // "foo" specifications specification ecmascript (ecma-262)the definition of 'get symbol.prototype.description' in that specification.
Symbol.toStringTag - JavaScript
no enumerable no configurable no examples default tags object.prototype.tostring.call('foo'); // "[object string]" object.prototype.tostring.call([1, 2]); // "[object array]" object.prototype.tostring.call(3); // "[object number]" object.prototype.tostring.call(true); // "[object boolean]" object.prototype.tostring.call(
undefined); // "[object
undefined]" object.prototype.tostring.call(null); // "[object null]" // ...
Greater than (>) - JavaScript
ole.log(5 > "hello"); // false console.log("5" > 3n); // true console.log("3" > 5n); // false number to number comparison console.log(5 > 3); // true console.log(3 > 3); // false console.log(3 > 5); // false number to bigint comparison console.log(5n > 3); // true console.log(3 > 5n); // false comparing boolean, null,
undefined, nan console.log(true > false); // true console.log(false > true); // false console.log(true > 0); // true console.log(true > 1); // false console.log(null > 0); // false console.log(1 > null); // true console.log(
undefined > 3); // false console.log(3 >
undefined); // false console.log(3 > nan); // false console.log(nan > 3); /...
Greater than or equal (>=) - JavaScript
// false console.log("hello" >= 5); // false console.log(5 >= "hello"); // false number to number comparison console.log(5 >= 3); // true console.log(3 >= 3); // true console.log(3 >= 5); // false number to bigint comparison console.log(5n >= 3); // true console.log(3 >= 3n); // true console.log(3 >= 5n); // false comparing boolean, null,
undefined, nan console.log(true >= false); // true console.log(true >= true); // true console.log(false >= true); // false console.log(true >= 0); // true console.log(true >= 1); // true console.log(null >= 0); // true console.log(1 >= null); // true console.log(
undefined >= 3); // false console.log(3 >=
undefined); // false console.log(3 >= nan); // false console.log(nan...
Inequality (!=) - JavaScript
ferent, use the strict inequality operator instead: 3 !== "3"; // true examples comparison with no type conversion 1 != 2; // true "hello" != "hola"; // true 1 != 1; // false "hello" != "hello"; // false comparison with type conversion "1" != 1; // false 1 != "1"; // false 0 != false; // false 0 != null; // true 0 !=
undefined; // true 0 != !!null; // false, look at logical not operator 0 != !!
undefined; // false, look at logical not operator null !=
undefined; // false const number1 = new number(3); const number2 = new number(3); number1 != 3; // false number1 != number2; // true comparison of objects const object1 = {"key": "value"} const object2 = {"key": "value"}; object1 != obje...
Less than or equal (<=) - JavaScript
// true console.log("hello" <= 5); // false console.log(5 <= "hello"); // false number to number comparison console.log(5 <= 3); // false console.log(3 <= 3); // true console.log(3 <= 5); // true number to bigint comparison console.log(5n <= 3); // false console.log(3 <= 3n); // true console.log(3 <= 5n); // true comparing boolean, null,
undefined, nan console.log(true <= false); // false console.log(true <= true); // true console.log(false <= true); // true console.log(true <= 0); // false console.log(true <= 1); // true console.log(null <= 0); // true console.log(1 <= null); // false console.log(
undefined <= 3); // false console.log(3 <=
undefined); // false console.log(3 <= nan); // false console.log(n...
Logical AND (&&) - JavaScript
examples of expressions that can be converted to false are: null; nan; 0; empty string ("" or '' or ``);
undefined.
Logical NOT (!) - JavaScript
examples of expressions that can be converted to false are: null; nan; 0; empty string ("" or '' or ``);
undefined.
Operator precedence - JavaScript
(b || c); // evaluate `a` first, then produce `a` if `a` is not `null` and not `
undefined` a?.b.c; // evaluate `a` first, then produce `
undefined` if `a` is `null` or `
undefined` examples 3 > 2 && 2 > 1 // returns true 3 > 2 > 1 // returns false because 3 > 2 is true, then true is converted to 1 // in inequality operators, therefore true > 1 becomes 1 > 1, which // is false.
Strict inequality (!==) - JavaScript
o" !== "hola"); // true console.log(3 !== 3); // false console.log(3 !== 4); // true console.log(true !== true); // false console.log(true !== false); // true console.log(null !== null); // false comparing operands of different types console.log("3" !== 3); // true console.log(true !== 1); // true console.log(null !==
undefined); // true comparing objects const object1 = { name: "hello" } const object2 = { name: "hello" } console.log(object1 !== object2); // true console.log(object1 !== object1); // false specifications specification ecmascript (ecma-262)the definition of 'equality operators' in that specification.
await - JavaScript
var response = await promisedfunction().catch((err) => { console.error(err); }); // response will be
undefined if the promise is rejected specifications specification ecmascript (ecma-262)the definition of 'async functions' in that specification.
instanceof - JavaScript
however, objects created with the object literal notation are an exception here: although the prototype is
undefined, instanceof object returns true.
new operator - JavaScript
function car() {} car1 = new car(); car2 = new car(); console.log(car1.color); //
undefined car.prototype.color = 'original color'; console.log(car1.color); // 'original color' car1.color = 'black'; console.log(car1.color); // 'black' console.log(object.getprototypeof(car1).color); // 'original color' console.log(object.getprototypeof(car2).color); // 'original color' console.log(car1.color); // 'black' console.log(car2.color); // 'original color' if you didn't write the...
break - JavaScript
function testbreak(x) { var i = 0; while (i < 6) { if (i == 3) { (function() { break; })(); } i += 1; } return i * x; } testbreak(1); // syntaxerror: illegal break statement block_1: { console.log('1'); ( function() { break block_1; // syntaxerror:
undefined label 'block_1' })(); } specifications specification ecmascript (ecma-262)the definition of 'break statement' in that specification.
for...of - JavaScript
} iterating over other iterable objects you can also iterate over an object that explicitly implements the iterable protocol: const iterable = { [symbol.iterator]() { return { i: 0, next() { if (this.i < 3) { return { value: this.i++, done: false }; } return { value:
undefined, done: true }; } }; } }; for (const value of iterable) { console.log(value); } // 0 // 1 // 2 difference between for...of and for...in both for...in and for...of statements iterate over something.
if...else - JavaScript
any value that is not false,
undefined, null, 0, -0, nan, or the empty string (""), and any object, including a boolean object whose value is false, is considered truthy when used as the condition.