From 3b80812a1d4f68e57f35fca763f50bf3e5dfe997 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Fri, 19 Feb 2021 14:57:02 -0500 Subject: [PATCH] remove 'notranslate' 6 (#2518) --- .../api/abstractrange/collapsed/index.html | 2 +- .../api/abstractrange/endcontainer/index.html | 2 +- .../api/abstractrange/endoffset/index.html | 2 +- .../abstractrange/startcontainer/index.html | 2 +- .../api/abstractrange/startoffset/index.html | 2 +- .../prompt/index.html | 2 +- files/en-us/web/api/clipboard/read/index.html | 4 +- .../web/api/clipboard/readtext/index.html | 4 +- .../en-us/web/api/clipboard/write/index.html | 6 +- .../web/api/clipboard/writetext/index.html | 4 +- files/en-us/web/api/console/assert/index.html | 2 +- files/en-us/web/api/console/clear/index.html | 2 +- files/en-us/web/api/console/count/index.html | 2 +- .../web/api/console/countreset/index.html | 2 +- files/en-us/web/api/console/debug/index.html | 2 +- files/en-us/web/api/console/dir/index.html | 2 +- files/en-us/web/api/console/dirxml/index.html | 2 +- files/en-us/web/api/console/error/index.html | 2 +- files/en-us/web/api/console/group/index.html | 2 +- .../web/api/console/groupcollapsed/index.html | 2 +- .../en-us/web/api/console/groupend/index.html | 2 +- files/en-us/web/api/console/index.html | 22 +-- files/en-us/web/api/console/info/index.html | 2 +- files/en-us/web/api/console/log/index.html | 2 +- .../en-us/web/api/console/profile/index.html | 2 +- .../web/api/console/profileend/index.html | 2 +- files/en-us/web/api/console/table/index.html | 2 +- files/en-us/web/api/console/time/index.html | 2 +- .../en-us/web/api/console/timeend/index.html | 2 +- .../en-us/web/api/console/timelog/index.html | 2 +- .../web/api/console/timestamp/index.html | 2 +- files/en-us/web/api/console/trace/index.html | 2 +- files/en-us/web/api/console/warn/index.html | 2 +- .../countqueuingstrategy/index.html | 2 +- .../api/countqueuingstrategy/size/index.html | 2 +- .../web/api/cssmathmax/cssmathmax/index.html | 2 +- .../web/api/cssmathmax/values/index.html | 2 +- .../web/api/cssmathvalue/operator/index.html | 8 +- .../getrgbcolorvalue/index.html | 2 +- .../setfloatvalue/index.html | 2 +- .../setstringvalue/index.html | 2 +- .../api/csspseudoelement/element/index.html | 2 +- .../web/api/csspseudoelement/type/index.html | 2 +- .../absolute/index.html | 2 +- .../deviceorientationevent/alpha/index.html | 2 +- .../deviceorientationevent/beta/index.html | 2 +- .../deviceorientationevent/index.html | 2 +- .../deviceorientationevent/gamma/index.html | 2 +- .../web/api/deviceorientationevent/index.html | 2 +- .../api/eventlistener/handleevent/index.html | 2 +- .../en-us/web/api/filereader/abort/index.html | 2 +- .../en-us/web/api/filereader/error/index.html | 2 +- .../web/api/filereader/onabort/index.html | 2 +- .../web/api/filereader/onerror/index.html | 2 +- .../filereader/readasarraybuffer/index.html | 2 +- .../filereader/readasbinarystring/index.html | 2 +- .../api/filereader/readasdataurl/index.html | 2 +- .../web/api/filereader/readastext/index.html | 2 +- .../web/api/filereader/result/index.html | 2 +- .../entries/index.html | 2 +- .../getdirectoryhandle/index.html | 4 +- .../getfilehandle/index.html | 4 +- .../api/filesystemdirectoryhandle/index.html | 4 +- .../filesystemdirectoryhandle/keys/index.html | 2 +- .../removeentry/index.html | 4 +- .../resolve/index.html | 4 +- .../values/index.html | 2 +- .../allowpaymentrequest/index.html | 2 +- .../web/api/htmliframeelement/csp/index.html | 2 +- .../featurepolicy/index.html | 2 +- .../referrerpolicy/index.html | 2 +- .../web/api/htmliframeelement/src/index.html | 2 +- .../web/api/htmllinkelement/as/index.html | 2 +- .../htmllinkelement/referrerpolicy/index.html | 2 +- .../web/api/htmllinkelement/rel/index.html | 2 +- .../api/htmllinkelement/rellist/index.html | 2 +- .../getdistributednodes/index.html | 2 +- .../web/api/htmltableelement/align/index.html | 2 +- .../api/htmltableelement/bgcolor/index.html | 2 +- .../api/htmltableelement/border/index.html | 2 +- .../api/htmltableelement/caption/index.html | 2 +- .../htmltableelement/cellpadding/index.html | 2 +- .../htmltableelement/cellspacing/index.html | 2 +- .../htmltableelement/createcaption/index.html | 6 +- .../htmltableelement/createtbody/index.html | 2 +- .../htmltableelement/createtfoot/index.html | 2 +- .../htmltableelement/createthead/index.html | 2 +- .../htmltableelement/deletecaption/index.html | 2 +- .../api/htmltableelement/deleterow/index.html | 2 +- .../htmltableelement/deletetfoot/index.html | 2 +- .../htmltableelement/deletethead/index.html | 2 +- .../web/api/htmltableelement/frame/index.html | 2 +- .../api/htmltableelement/insertrow/index.html | 2 +- .../web/api/htmltableelement/rows/index.html | 2 +- .../web/api/htmltableelement/rules/index.html | 2 +- .../api/htmltableelement/summary/index.html | 2 +- .../api/htmltableelement/tbodies/index.html | 2 +- .../web/api/htmltableelement/tfoot/index.html | 2 +- .../web/api/htmltableelement/thead/index.html | 2 +- .../web/api/htmltableelement/width/index.html | 2 +- .../web/api/idbkeyrange/bound/index.html | 2 +- .../web/api/idbkeyrange/includes/index.html | 2 +- .../web/api/idbkeyrange/lower/index.html | 2 +- .../web/api/idbkeyrange/lowerbound/index.html | 4 +- .../web/api/idbkeyrange/loweropen/index.html | 2 +- .../en-us/web/api/idbkeyrange/only/index.html | 2 +- .../web/api/idbkeyrange/upper/index.html | 2 +- .../web/api/idbkeyrange/upperbound/index.html | 4 +- .../web/api/idbkeyrange/upperopen/index.html | 2 +- .../web/api/keyboard/getlayoutmap/index.html | 2 +- files/en-us/web/api/keyboard/lock/index.html | 2 +- .../en-us/web/api/keyboard/unlock/index.html | 2 +- .../audiobitspersecond/index.html | 2 +- .../mediarecorder/ignoremutedmedia/index.html | 2 +- .../mediarecorder/istypesupported/index.html | 2 +- .../mediarecorder/mediarecorder/index.html | 2 +- .../web/api/mediarecorder/mimetype/index.html | 2 +- .../mediarecorder/ondataavailable/index.html | 2 +- .../web/api/mediarecorder/onerror/index.html | 4 +- .../web/api/mediarecorder/onpause/index.html | 2 +- .../web/api/mediarecorder/onresume/index.html | 2 +- .../web/api/mediarecorder/onstart/index.html | 2 +- .../web/api/mediarecorder/onstop/index.html | 2 +- .../api/mediarecorder/onwarning/index.html | 2 +- .../web/api/mediarecorder/pause/index.html | 2 +- .../api/mediarecorder/requestdata/index.html | 2 +- .../web/api/mediarecorder/resume/index.html | 2 +- .../web/api/mediarecorder/start/index.html | 2 +- .../web/api/mediarecorder/state/index.html | 2 +- .../web/api/mediarecorder/stop/index.html | 2 +- .../web/api/mediarecorder/stream/index.html | 2 +- .../videobitspersecond/index.html | 2 +- .../web/api/mediasettingsrange/max/index.html | 2 +- .../web/api/mediasettingsrange/min/index.html | 2 +- .../api/mediasettingsrange/step/index.html | 2 +- .../web/api/mouseevent/altkey/index.html | 2 +- .../web/api/mouseevent/button/index.html | 2 +- .../web/api/mouseevent/buttons/index.html | 6 +- .../web/api/mouseevent/clientx/index.html | 6 +- .../web/api/mouseevent/clienty/index.html | 6 +- .../web/api/mouseevent/ctrlkey/index.html | 2 +- .../mouseevent/getmodifierstate/index.html | 2 +- files/en-us/web/api/mouseevent/index.html | 4 +- .../api/mouseevent/initmouseevent/index.html | 2 +- .../web/api/mouseevent/metakey/index.html | 2 +- .../web/api/mouseevent/mouseevent/index.html | 2 +- .../web/api/mouseevent/movementx/index.html | 2 +- .../web/api/mouseevent/movementy/index.html | 2 +- .../api/mouseevent/mozinputsource/index.html | 2 +- .../web/api/mouseevent/offsetx/index.html | 2 +- .../web/api/mouseevent/offsety/index.html | 2 +- .../en-us/web/api/mouseevent/pagex/index.html | 2 +- .../en-us/web/api/mouseevent/pagey/index.html | 2 +- .../web/api/mouseevent/region/index.html | 2 +- .../api/mouseevent/relatedtarget/index.html | 2 +- .../web/api/mouseevent/screenx/index.html | 2 +- .../web/api/mouseevent/screeny/index.html | 2 +- .../web/api/mouseevent/shiftkey/index.html | 2 +- .../en-us/web/api/mouseevent/which/index.html | 2 +- .../networkinformation/downlink/index.html | 2 +- .../networkinformation/downlinkmax/index.html | 2 +- .../effectivetype/index.html | 2 +- .../networkinformation/onchange/index.html | 2 +- .../web/api/networkinformation/rtt/index.html | 2 +- .../networkinformation/savedata/index.html | 2 +- .../api/networkinformation/type/index.html | 2 +- .../web/api/nodeiterator/detach/index.html | 2 +- .../expandentityreferences/index.html | 2 +- .../web/api/nodeiterator/filter/index.html | 2 +- files/en-us/web/api/nodeiterator/index.html | 2 +- .../web/api/nodeiterator/nextnode/index.html | 2 +- .../pointerbeforereferencenode/index.html | 2 +- .../api/nodeiterator/previousnode/index.html | 2 +- .../api/nodeiterator/referencenode/index.html | 2 +- .../web/api/nodeiterator/root/index.html | 2 +- .../api/nodeiterator/whattoshow/index.html | 2 +- .../framebuffertexturemultiviewovr/index.html | 2 +- .../api/pannernode/orientationx/index.html | 2 +- .../api/pannernode/orientationy/index.html | 2 +- .../api/pannernode/orientationz/index.html | 2 +- .../web/api/pannernode/positionx/index.html | 2 +- .../web/api/pannernode/positiony/index.html | 2 +- .../web/api/pannernode/positionz/index.html | 2 +- .../api/paymentaddress/addressline/index.html | 2 +- .../web/api/paymentaddress/city/index.html | 2 +- .../web/api/paymentaddress/country/index.html | 2 +- .../dependentlocality/index.html | 2 +- .../paymentaddress/languagecode/index.html | 2 +- .../paymentaddress/organization/index.html | 2 +- .../web/api/paymentaddress/phone/index.html | 2 +- .../api/paymentaddress/postalcode/index.html | 2 +- .../api/paymentaddress/recipient/index.html | 2 +- .../web/api/paymentaddress/region/index.html | 2 +- .../api/paymentaddress/regioncode/index.html | 2 +- .../api/paymentaddress/sortingcode/index.html | 2 +- .../web/api/paymentaddress/tojson/index.html | 2 +- .../pictureinpicturewindow/height/index.html | 2 +- .../web/api/pictureinpicturewindow/index.html | 2 +- .../onresize/index.html | 6 +- .../resize_event/index.html | 6 +- .../pictureinpicturewindow/width/index.html | 2 +- .../getcoalescedevents/index.html | 2 +- .../web/api/pointerevent/height/index.html | 2 +- .../web/api/pointerevent/isprimary/index.html | 4 +- .../api/pointerevent/pointerevent/index.html | 2 +- .../web/api/pointerevent/pointerid/index.html | 2 +- .../api/pointerevent/pointertype/index.html | 2 +- .../web/api/pointerevent/pressure/index.html | 2 +- .../tangentialpressure/index.html | 2 +- .../web/api/pointerevent/tiltx/index.html | 2 +- .../web/api/pointerevent/tilty/index.html | 2 +- .../web/api/pointerevent/twist/index.html | 2 +- .../web/api/pointerevent/width/index.html | 2 +- .../reportingobserver/disconnect/index.html | 2 +- .../api/reportingobserver/observe/index.html | 2 +- .../reportingobserver/index.html | 2 +- .../reportingobserver/takerecords/index.html | 2 +- .../address/index.html | 4 +- .../rtcsessiondescription/index.html | 2 +- .../api/rtcsessiondescription/sdp/index.html | 2 +- .../rtcsessiondescription/tojson/index.html | 2 +- .../api/rtcsessiondescription/type/index.html | 2 +- .../web/api/sharedworker/port/index.html | 2 +- .../api/sharedworker/sharedworker/index.html | 4 +- .../web/api/storageestimate/quota/index.html | 2 +- .../web/api/storageestimate/usage/index.html | 2 +- files/en-us/web/api/storageevent/index.html | 4 +- .../entries/index.html | 4 +- .../foreach/index.html | 4 +- .../stylepropertymapreadonly/get/index.html | 8 +- .../getall/index.html | 4 +- .../stylepropertymapreadonly/has/index.html | 4 +- .../api/stylepropertymapreadonly/index.html | 6 +- .../stylepropertymapreadonly/keys/index.html | 4 +- .../stylepropertymapreadonly/size/index.html | 4 +- .../values/index.html | 4 +- .../web/api/wheelevent/deltamode/index.html | 2 +- .../web/api/wheelevent/deltax/index.html | 2 +- .../web/api/wheelevent/deltay/index.html | 2 +- .../web/api/wheelevent/deltaz/index.html | 4 +- .../web/api/wheelevent/wheelevent/index.html | 2 +- .../api/xrpose/emulatedposition/index.html | 2 +- .../en-us/web/api/xrpose/transform/index.html | 2 +- .../getoffsetreferencespace/index.html | 10 +- .../api/xrreferencespace/onreset/index.html | 2 +- .../xrreferencespace/reset_event/index.html | 4 +- .../xrsession/cancelanimationframe/index.html | 2 +- files/en-us/web/api/xrsession/end/index.html | 2 +- .../xrsession/environmentblendmode/index.html | 2 +- .../web/api/xrsession/inputsources/index.html | 2 +- .../en-us/web/api/xrsession/onend/index.html | 2 +- .../web/api/xrsession/onselect/index.html | 2 +- .../web/api/xrsession/onselectend/index.html | 2 +- .../api/xrsession/onselectstart/index.html | 2 +- .../web/api/xrsession/onsqueeze/index.html | 2 +- .../web/api/xrsession/onsqueezeend/index.html | 2 +- .../api/xrsession/onsqueezestart/index.html | 2 +- .../xrsession/onvisibilitychange/index.html | 2 +- .../web/api/xrsession/renderstate/index.html | 2 +- .../requestanimationframe/index.html | 2 +- .../requestreferencespace/index.html | 2 +- .../xrsession/updaterenderstate/index.html | 2 +- .../api/xrsession/visibilitystate/index.html | 2 +- .../index.html | 162 +++++++++--------- .../en-us/web/javascript/closures/index.html | 38 ++-- .../web/javascript/data_structures/index.html | 6 +- .../index.html | 10 +- .../index.html | 14 +- .../expressions_and_operators/index.html | 74 ++++---- .../web/javascript/guide/functions/index.html | 74 ++++---- .../guide/grammar_and_types/index.html | 92 +++++----- .../guide/indexed_collections/index.html | 86 +++++----- .../javascript/guide/introduction/index.html | 4 +- .../guide/iterators_and_generators/index.html | 14 +- .../guide/loops_and_iteration/index.html | 42 ++--- .../web/javascript/guide/modules/index.html | 84 ++++----- .../guide/numbers_and_dates/index.html | 28 +-- .../character_classes/index.html | 6 +- .../regular_expressions/cheatsheet/index.html | 2 +- .../groups_and_ranges/index.html | 6 +- .../guide/regular_expressions/index.html | 32 ++-- .../quantifiers/index.html | 8 +- .../unicode_property_escapes/index.html | 10 +- .../guide/using_promises/index.html | 54 +++--- .../guide/working_with_objects/index.html | 76 ++++---- .../index.html | 54 +++--- .../reference/classes/constructor/index.html | 16 +- .../reference/classes/extends/index.html | 6 +- .../javascript/reference/classes/index.html | 38 ++-- .../classes/private_class_fields/index.html | 16 +- .../classes/public_class_fields/index.html | 2 +- .../reference/classes/static/index.html | 8 +- .../aggregateerror/aggregateerror/index.html | 2 +- .../global_objects/aggregateerror/index.html | 4 +- .../array/@@iterator/index.html | 10 +- .../global_objects/array/@@species/index.html | 6 +- .../array/@@unscopables/index.html | 2 +- .../global_objects/array/array/index.html | 2 +- .../global_objects/array/at/index.html | 6 +- .../global_objects/array/concat/index.html | 2 +- .../array/copywithin/index.html | 6 +- .../global_objects/array/entries/index.html | 6 +- .../global_objects/array/every/index.html | 10 +- .../global_objects/array/fill/index.html | 8 +- .../global_objects/array/filter/index.html | 16 +- .../global_objects/array/find/index.html | 12 +- .../global_objects/array/findindex/index.html | 2 +- .../global_objects/array/flat/index.html | 12 +- .../global_objects/array/flatmap/index.html | 10 +- .../global_objects/array/foreach/index.html | 20 +-- .../global_objects/array/from/index.html | 18 +- .../global_objects/array/includes/index.html | 10 +- .../reference/global_objects/array/index.html | 52 +++--- .../global_objects/array/indexof/index.html | 12 +- .../global_objects/array/isarray/index.html | 2 +- .../global_objects/array/join/index.html | 2 +- .../global_objects/array/keys/index.html | 4 +- .../array/lastindexof/index.html | 8 +- .../global_objects/array/length/index.html | 10 +- .../global_objects/array/map/index.html | 24 +-- .../global_objects/array/of/index.html | 8 +- .../global_objects/array/pop/index.html | 6 +- .../global_objects/array/push/index.html | 8 +- .../global_objects/array/reduce/index.html | 40 ++--- .../array/reduceright/index.html | 20 +-- .../global_objects/array/reverse/index.html | 6 +- .../global_objects/array/shift/index.html | 6 +- .../global_objects/array/some/index.html | 14 +- .../global_objects/array/sort/index.html | 20 +-- .../global_objects/array/splice/index.html | 18 +- .../array/tolocalestring/index.html | 6 +- .../global_objects/array/tosource/index.html | 2 +- .../global_objects/array/tostring/index.html | 4 +- .../global_objects/array/unshift/index.html | 4 +- .../global_objects/array/values/index.html | 12 +- .../arraybuffer/@@species/index.html | 4 +- .../arraybuffer/arraybuffer/index.html | 8 +- .../arraybuffer/bytelength/index.html | 2 +- .../arraybuffer/isview/index.html | 4 +- .../arraybuffer/slice/index.html | 4 +- .../global_objects/asyncfunction/index.html | 2 +- .../global_objects/atomics/add/index.html | 4 +- .../global_objects/atomics/and/index.html | 6 +- .../atomics/compareexchange/index.html | 4 +- .../atomics/exchange/index.html | 4 +- .../global_objects/atomics/index.html | 8 +- .../atomics/islockfree/index.html | 4 +- .../global_objects/atomics/load/index.html | 4 +- .../global_objects/atomics/notify/index.html | 8 +- .../global_objects/atomics/or/index.html | 6 +- .../global_objects/atomics/store/index.html | 4 +- .../global_objects/atomics/sub/index.html | 4 +- .../global_objects/atomics/wait/index.html | 8 +- .../global_objects/atomics/xor/index.html | 6 +- .../global_objects/bigint/asintn/index.html | 2 +- .../global_objects/bigint/asuintn/index.html | 2 +- .../global_objects/bigint/bigint/index.html | 2 +- .../global_objects/bigint/index.html | 26 +-- .../bigint/tolocalestring/index.html | 2 +- .../global_objects/bigint/tostring/index.html | 2 +- .../global_objects/bigint/valueof/index.html | 2 +- .../biguint64array/biguint64array/index.html | 2 +- .../global_objects/boolean/boolean/index.html | 2 +- .../global_objects/boolean/index.html | 12 +- .../boolean/tosource/index.html | 2 +- .../boolean/tostring/index.html | 4 +- .../global_objects/boolean/valueof/index.html | 4 +- .../global_objects/dataview/buffer/index.html | 2 +- .../dataview/bytelength/index.html | 2 +- .../dataview/byteoffset/index.html | 2 +- .../dataview/dataview/index.html | 4 +- .../dataview/getbigint64/index.html | 2 +- .../dataview/getbiguint64/index.html | 2 +- .../dataview/getfloat32/index.html | 4 +- .../dataview/getfloat64/index.html | 4 +- .../dataview/getint16/index.html | 4 +- .../dataview/getint32/index.html | 4 +- .../dataview/getint8/index.html | 4 +- .../dataview/getuint16/index.html | 4 +- .../dataview/getuint32/index.html | 4 +- .../dataview/getuint8/index.html | 4 +- .../dataview/setbigint64/index.html | 2 +- .../dataview/setbiguint64/index.html | 2 +- .../dataview/setfloat32/index.html | 4 +- .../dataview/setfloat64/index.html | 4 +- .../dataview/setint16/index.html | 4 +- .../dataview/setint32/index.html | 4 +- .../dataview/setint8/index.html | 4 +- .../dataview/setuint16/index.html | 4 +- .../dataview/setuint32/index.html | 4 +- .../dataview/setuint8/index.html | 4 +- .../date/@@toprimitive/index.html | 4 +- .../global_objects/date/date/index.html | 4 +- .../global_objects/date/getdate/index.html | 4 +- .../global_objects/date/getday/index.html | 6 +- .../date/getfullyear/index.html | 4 +- .../global_objects/date/gethours/index.html | 4 +- .../date/getmilliseconds/index.html | 4 +- .../global_objects/date/getminutes/index.html | 4 +- .../global_objects/date/getmonth/index.html | 6 +- .../global_objects/date/getseconds/index.html | 4 +- .../global_objects/date/gettime/index.html | 8 +- .../date/gettimezoneoffset/index.html | 4 +- .../global_objects/date/getutcdate/index.html | 4 +- .../global_objects/date/getutcday/index.html | 4 +- .../date/getutcfullyear/index.html | 4 +- .../date/getutchours/index.html | 4 +- .../date/getutcmilliseconds/index.html | 4 +- .../date/getutcminutes/index.html | 4 +- .../date/getutcmonth/index.html | 4 +- .../date/getutcseconds/index.html | 4 +- .../global_objects/date/getyear/index.html | 10 +- .../reference/global_objects/date/index.html | 14 +- .../global_objects/date/now/index.html | 6 +- .../global_objects/date/parse/index.html | 4 +- .../global_objects/date/setdate/index.html | 4 +- .../date/setfullyear/index.html | 4 +- .../global_objects/date/sethours/index.html | 6 +- .../date/setmilliseconds/index.html | 4 +- .../global_objects/date/setminutes/index.html | 6 +- .../global_objects/date/setmonth/index.html | 6 +- .../global_objects/date/setseconds/index.html | 6 +- .../global_objects/date/settime/index.html | 4 +- .../global_objects/date/setutcdate/index.html | 4 +- .../date/setutcfullyear/index.html | 4 +- .../date/setutchours/index.html | 4 +- .../date/setutcmilliseconds/index.html | 4 +- .../date/setutcminutes/index.html | 4 +- .../date/setutcmonth/index.html | 4 +- .../date/setutcseconds/index.html | 4 +- .../global_objects/date/setyear/index.html | 4 +- .../date/todatestring/index.html | 4 +- .../date/togmtstring/index.html | 4 +- .../date/toisostring/index.html | 6 +- .../global_objects/date/tojson/index.html | 4 +- .../date/tolocaledatestring/index.html | 10 +- .../date/tolocalestring/index.html | 12 +- .../date/tolocaletimestring/index.html | 10 +- .../global_objects/date/tosource/index.html | 2 +- .../global_objects/date/tostring/index.html | 4 +- .../date/totimestring/index.html | 4 +- .../date/toutcstring/index.html | 4 +- .../global_objects/date/utc/index.html | 8 +- .../global_objects/date/valueof/index.html | 4 +- .../global_objects/decodeuri/index.html | 6 +- .../decodeuricomponent/index.html | 2 +- .../global_objects/encodeuri/index.html | 12 +- .../encodeuricomponent/index.html | 12 +- .../error/columnnumber/index.html | 2 +- .../global_objects/error/filename/index.html | 2 +- .../reference/global_objects/error/index.html | 8 +- .../error/linenumber/index.html | 4 +- .../global_objects/error/message/index.html | 2 +- .../global_objects/error/tosource/index.html | 4 +- .../global_objects/error/tostring/index.html | 6 +- .../global_objects/escape/index.html | 2 +- .../reference/global_objects/eval/index.html | 2 +- .../evalerror/evalerror/index.html | 4 +- .../global_objects/evalerror/index.html | 2 +- .../float32array/float32array/index.html | 2 +- .../global_objects/float32array/index.html | 2 +- .../float64array/float64array/index.html | 2 +- .../global_objects/function/apply/index.html | 18 +- .../global_objects/function/bind/index.html | 20 +-- .../global_objects/function/call/index.html | 2 +- .../global_objects/function/caller/index.html | 10 +- .../function/function/index.html | 4 +- .../global_objects/function/index.html | 2 +- .../global_objects/function/length/index.html | 2 +- .../global_objects/function/name/index.html | 34 ++-- .../function/tosource/index.html | 8 +- .../function/tostring/index.html | 56 +++--- .../global_objects/generator/index.html | 4 +- .../global_objects/generator/next/index.html | 8 +- .../generator/return/index.html | 6 +- .../global_objects/generator/throw/index.html | 4 +- .../generatorfunction/index.html | 2 +- .../global_objects/int32array/index.html | 8 +- .../int32array/int32array/index.html | 8 +- .../global_objects/internalerror/index.html | 4 +- .../internalerror/internalerror/index.html | 4 +- .../intl/@@tostringtag/index.html | 4 +- .../intl/collator/collator/index.html | 4 +- .../intl/collator/compare/index.html | 6 +- .../global_objects/intl/collator/index.html | 6 +- .../intl/collator/resolvedoptions/index.html | 4 +- .../collator/supportedlocalesof/index.html | 4 +- .../datetimeformat/datetimeformat/index.html | 6 +- .../intl/datetimeformat/format/index.html | 8 +- .../datetimeformat/formatrange/index.html | 4 +- .../formatrangetoparts/index.html | 4 +- .../datetimeformat/formattoparts/index.html | 22 +-- .../intl/datetimeformat/index.html | 8 +- .../datetimeformat/resolvedoptions/index.html | 4 +- .../supportedlocalesof/index.html | 4 +- .../intl/displaynames/displaynames/index.html | 4 +- .../intl/displaynames/index.html | 8 +- .../intl/displaynames/of/index.html | 4 +- .../displaynames/resolvedoptions/index.html | 4 +- .../supportedlocalesof/index.html | 4 +- .../intl/getcanonicallocales/index.html | 4 +- .../reference/global_objects/intl/index.html | 2 +- .../intl/listformat/format/index.html | 4 +- .../intl/listformat/formattoparts/index.html | 2 +- .../global_objects/intl/listformat/index.html | 4 +- .../intl/listformat/listformat/index.html | 4 +- .../listformat/resolvedoptions/index.html | 2 +- .../listformat/supportedlocalesof/index.html | 4 +- .../intl/locale/locale/index.html | 6 +- .../intl/locale/maximize/index.html | 2 +- .../intl/locale/minimize/index.html | 2 +- .../intl/locale/tostring/index.html | 2 +- .../intl/numberformat/format/index.html | 6 +- .../numberformat/formattoparts/index.html | 12 +- .../intl/numberformat/index.html | 8 +- .../intl/numberformat/numberformat/index.html | 16 +- .../numberformat/resolvedoptions/index.html | 2 +- .../supportedlocalesof/index.html | 4 +- .../intl/pluralrules/index.html | 2 +- .../intl/pluralrules/pluralrules/index.html | 2 +- .../pluralrules/resolvedoptions/index.html | 2 +- .../intl/pluralrules/select/index.html | 4 +- .../pluralrules/supportedlocalesof/index.html | 4 +- .../intl/relativetimeformat/format/index.html | 6 +- .../intl/relativetimeformat/index.html | 4 +- .../relativetimeformat/index.html | 6 +- .../resolvedoptions/index.html | 2 +- .../supportedlocalesof/index.html | 4 +- .../global_objects/isfinite/index.html | 4 +- .../reference/global_objects/isnan/index.html | 6 +- .../reference/global_objects/json/index.html | 6 +- .../global_objects/json/parse/index.html | 12 +- .../global_objects/json/stringify/index.html | 26 +-- .../global_objects/map/@@iterator/index.html | 6 +- .../global_objects/map/@@species/index.html | 4 +- .../map/@@tostringtag/index.html | 2 +- .../global_objects/map/clear/index.html | 4 +- .../global_objects/map/delete/index.html | 4 +- .../global_objects/map/entries/index.html | 4 +- .../global_objects/map/foreach/index.html | 4 +- .../global_objects/map/get/index.html | 4 +- .../global_objects/map/has/index.html | 4 +- .../reference/global_objects/map/index.html | 22 +-- .../global_objects/map/keys/index.html | 4 +- .../global_objects/map/map/index.html | 2 +- .../global_objects/map/set/index.html | 6 +- .../global_objects/map/size/index.html | 2 +- .../global_objects/map/values/index.html | 4 +- .../global_objects/math/abs/index.html | 4 +- .../global_objects/math/acos/index.html | 4 +- .../global_objects/math/acosh/index.html | 6 +- .../global_objects/math/asin/index.html | 4 +- .../global_objects/math/asinh/index.html | 6 +- .../global_objects/math/atan/index.html | 4 +- .../global_objects/math/atan2/index.html | 4 +- .../global_objects/math/atanh/index.html | 6 +- .../global_objects/math/cbrt/index.html | 6 +- .../global_objects/math/ceil/index.html | 2 +- .../global_objects/math/clz32/index.html | 14 +- .../global_objects/math/cos/index.html | 4 +- .../global_objects/math/cosh/index.html | 8 +- .../global_objects/math/e/index.html | 2 +- .../global_objects/math/exp/index.html | 4 +- .../global_objects/math/expm1/index.html | 4 +- .../global_objects/math/floor/index.html | 6 +- .../global_objects/math/fround/index.html | 14 +- .../global_objects/math/hypot/index.html | 8 +- .../global_objects/math/imul/index.html | 8 +- .../reference/global_objects/math/index.html | 6 +- .../global_objects/math/ln10/index.html | 2 +- .../global_objects/math/ln2/index.html | 2 +- .../global_objects/math/log/index.html | 6 +- .../global_objects/math/log10/index.html | 6 +- .../global_objects/math/log10e/index.html | 2 +- .../global_objects/math/log1p/index.html | 4 +- .../global_objects/math/log2/index.html | 6 +- .../global_objects/math/log2e/index.html | 2 +- .../global_objects/math/max/index.html | 10 +- .../global_objects/math/min/index.html | 8 +- .../global_objects/math/pi/index.html | 2 +- .../global_objects/math/pow/index.html | 4 +- .../global_objects/math/random/index.html | 10 +- .../global_objects/math/round/index.html | 4 +- .../global_objects/math/sign/index.html | 6 +- .../global_objects/math/sin/index.html | 4 +- .../global_objects/math/sinh/index.html | 8 +- .../global_objects/math/sqrt/index.html | 4 +- .../global_objects/math/sqrt1_2/index.html | 2 +- .../global_objects/math/sqrt2/index.html | 2 +- .../global_objects/math/tan/index.html | 6 +- .../global_objects/math/tanh/index.html | 6 +- .../global_objects/math/trunc/index.html | 8 +- .../reference/global_objects/nan/index.html | 6 +- .../reference/global_objects/null/index.html | 8 +- .../global_objects/number/epsilon/index.html | 4 +- .../global_objects/number/index.html | 12 +- .../global_objects/number/isfinite/index.html | 6 +- .../number/isinteger/index.html | 6 +- .../global_objects/number/isnan/index.html | 6 +- .../number/issafeinteger/index.html | 6 +- .../number/max_safe_integer/index.html | 6 +- .../number/max_value/index.html | 2 +- .../number/min_safe_integer/index.html | 2 +- .../number/min_value/index.html | 2 +- .../global_objects/number/nan/index.html | 2 +- .../number/negative_infinity/index.html | 2 +- .../number/parsefloat/index.html | 6 +- .../global_objects/number/parseint/index.html | 2 +- .../number/positive_infinity/index.html | 2 +- .../number/toexponential/index.html | 4 +- .../global_objects/number/tofixed/index.html | 4 +- .../number/tolocalestring/index.html | 2 +- .../number/toprecision/index.html | 2 +- .../global_objects/number/tosource/index.html | 2 +- .../global_objects/number/tostring/index.html | 4 +- .../global_objects/number/valueof/index.html | 4 +- .../object/__definegetter__/index.html | 6 +- .../object/__definesetter__/index.html | 8 +- .../object/__lookupgetter__/index.html | 4 +- .../object/__lookupsetter__/index.html | 4 +- .../global_objects/object/assign/index.html | 22 +-- .../object/constructor/index.html | 24 +-- .../global_objects/object/create/index.html | 36 ++-- .../object/defineproperties/index.html | 6 +- .../object/defineproperty/index.html | 24 +-- .../global_objects/object/entries/index.html | 10 +- .../global_objects/object/freeze/index.html | 16 +- .../object/fromentries/index.html | 8 +- .../getownpropertydescriptor/index.html | 6 +- .../getownpropertydescriptors/index.html | 6 +- .../object/getownpropertynames/index.html | 10 +- .../object/getownpropertysymbols/index.html | 4 +- .../object/getprototypeof/index.html | 6 +- .../object/hasownproperty/index.html | 14 +- .../global_objects/object/is/index.html | 6 +- .../object/isextensible/index.html | 6 +- .../global_objects/object/isfrozen/index.html | 6 +- .../object/isprototypeof/index.html | 6 +- .../global_objects/object/issealed/index.html | 6 +- .../global_objects/object/keys/index.html | 8 +- .../global_objects/object/object/index.html | 10 +- .../object/preventextensions/index.html | 8 +- .../object/propertyisenumerable/index.html | 8 +- .../global_objects/object/proto/index.html | 2 +- .../global_objects/object/seal/index.html | 6 +- .../object/setprototypeof/index.html | 14 +- .../object/tolocalestring/index.html | 8 +- .../global_objects/object/tosource/index.html | 12 +- .../global_objects/object/tostring/index.html | 22 +-- .../global_objects/object/valueof/index.html | 10 +- .../global_objects/object/values/index.html | 2 +- .../global_objects/parsefloat/index.html | 8 +- .../global_objects/parseint/index.html | 26 +-- .../global_objects/promise/all/index.html | 16 +- .../promise/allsettled/index.html | 4 +- .../global_objects/promise/any/index.html | 8 +- .../global_objects/promise/catch/index.html | 10 +- .../global_objects/promise/finally/index.html | 4 +- .../global_objects/promise/index.html | 32 ++-- .../global_objects/promise/promise/index.html | 10 +- .../global_objects/promise/race/index.html | 10 +- .../global_objects/promise/reject/index.html | 4 +- .../global_objects/promise/resolve/index.html | 10 +- .../global_objects/promise/then/index.html | 22 +-- .../reference/global_objects/proxy/index.html | 26 +-- .../proxy/proxy/apply/index.html | 4 +- .../proxy/proxy/construct/index.html | 8 +- .../proxy/proxy/defineproperty/index.html | 6 +- .../proxy/proxy/deleteproperty/index.html | 4 +- .../global_objects/proxy/proxy/get/index.html | 6 +- .../proxy/getownpropertydescriptor/index.html | 6 +- .../proxy/proxy/getprototypeof/index.html | 8 +- .../global_objects/proxy/proxy/has/index.html | 6 +- .../global_objects/proxy/proxy/index.html | 2 +- .../proxy/proxy/isextensible/index.html | 6 +- .../proxy/proxy/ownkeys/index.html | 6 +- .../proxy/proxy/preventextensions/index.html | 6 +- .../global_objects/proxy/proxy/set/index.html | 4 +- .../proxy/proxy/setprototypeof/index.html | 6 +- .../global_objects/proxy/revocable/index.html | 2 +- .../global_objects/rangeerror/index.html | 4 +- .../rangeerror/rangeerror/index.html | 2 +- .../global_objects/referenceerror/index.html | 4 +- .../referenceerror/referenceerror/index.html | 6 +- .../global_objects/reflect/apply/index.html | 6 +- .../reflect/construct/index.html | 2 +- .../reflect/defineproperty/index.html | 6 +- .../reflect/deleteproperty/index.html | 4 +- .../global_objects/reflect/get/index.html | 2 +- .../getownpropertydescriptor/index.html | 6 +- .../reflect/getprototypeof/index.html | 6 +- .../global_objects/reflect/has/index.html | 6 +- .../reflect/isextensible/index.html | 6 +- .../global_objects/reflect/ownkeys/index.html | 4 +- .../reflect/preventextensions/index.html | 6 +- .../global_objects/reflect/set/index.html | 4 +- .../reflect/setprototypeof/index.html | 4 +- .../global_objects/regexp/@@match/index.html | 2 +- .../regexp/@@matchall/index.html | 8 +- .../regexp/@@replace/index.html | 8 +- .../global_objects/regexp/@@search/index.html | 8 +- .../regexp/@@species/index.html | 4 +- .../global_objects/regexp/@@split/index.html | 8 +- .../global_objects/regexp/compile/index.html | 2 +- .../global_objects/regexp/exec/index.html | 10 +- .../global_objects/regexp/flags/index.html | 4 +- .../global_objects/regexp/global/index.html | 2 +- .../regexp/ignorecase/index.html | 2 +- .../global_objects/regexp/index.html | 20 +-- .../regexp/lastindex/index.html | 6 +- .../regexp/lastmatch/index.html | 2 +- .../regexp/lastparen/index.html | 2 +- .../regexp/leftcontext/index.html | 2 +- .../regexp/multiline/index.html | 2 +- .../global_objects/regexp/n/index.html | 4 +- .../global_objects/regexp/regexp/index.html | 4 +- .../regexp/rightcontext/index.html | 2 +- .../global_objects/regexp/source/index.html | 4 +- .../global_objects/regexp/test/index.html | 8 +- .../global_objects/regexp/tosource/index.html | 4 +- .../global_objects/regexp/tostring/index.html | 6 +- .../global_objects/regexp/unicode/index.html | 2 +- .../global_objects/set/@@iterator/index.html | 6 +- .../global_objects/set/@@species/index.html | 4 +- .../global_objects/set/add/index.html | 4 +- .../global_objects/set/clear/index.html | 4 +- .../global_objects/set/delete/index.html | 6 +- .../global_objects/set/entries/index.html | 4 +- .../global_objects/set/foreach/index.html | 4 +- .../global_objects/set/has/index.html | 4 +- .../reference/global_objects/set/index.html | 14 +- .../global_objects/set/set/index.html | 2 +- .../global_objects/set/size/index.html | 2 +- .../global_objects/set/values/index.html | 4 +- .../sharedarraybuffer/bytelength/index.html | 2 +- .../sharedarraybuffer/index.html | 16 +- .../sharedarraybuffer/index.html | 6 +- .../sharedarraybuffer/slice/index.html | 4 +- .../string/@@iterator/index.html | 6 +- .../global_objects/string/anchor/index.html | 6 +- .../global_objects/string/at/index.html | 6 +- .../global_objects/string/big/index.html | 6 +- .../global_objects/string/blink/index.html | 4 +- .../global_objects/string/bold/index.html | 4 +- .../global_objects/string/charat/index.html | 12 +- .../string/charcodeat/index.html | 8 +- .../string/codepointat/index.html | 8 +- .../global_objects/string/concat/index.html | 4 +- .../global_objects/string/endswith/index.html | 6 +- .../global_objects/string/fixed/index.html | 4 +- .../string/fontcolor/index.html | 6 +- .../global_objects/string/fontsize/index.html | 6 +- .../string/fromcharcode/index.html | 6 +- .../string/fromcodepoint/index.html | 2 +- .../global_objects/string/includes/index.html | 2 +- .../global_objects/string/index.html | 24 +-- .../global_objects/string/indexof/index.html | 2 +- .../global_objects/string/italics/index.html | 4 +- .../string/lastindexof/index.html | 8 +- .../global_objects/string/length/index.html | 6 +- .../global_objects/string/link/index.html | 4 +- .../string/localecompare/index.html | 2 +- .../global_objects/string/match/index.html | 2 +- .../global_objects/string/matchall/index.html | 14 +- .../string/normalize/index.html | 2 +- .../global_objects/string/padend/index.html | 4 +- .../global_objects/string/padstart/index.html | 6 +- .../global_objects/string/raw/index.html | 4 +- .../global_objects/string/repeat/index.html | 6 +- .../global_objects/string/replace/index.html | 16 +- .../string/replaceall/index.html | 8 +- .../global_objects/string/search/index.html | 4 +- .../global_objects/string/slice/index.html | 12 +- .../global_objects/string/small/index.html | 6 +- .../global_objects/string/split/index.html | 24 +-- .../string/startswith/index.html | 6 +- .../global_objects/string/strike/index.html | 4 +- .../global_objects/string/string/index.html | 4 +- .../global_objects/string/sub/index.html | 4 +- .../global_objects/string/substr/index.html | 6 +- .../string/substring/index.html | 18 +- .../global_objects/string/sup/index.html | 4 +- .../string/tolocalelowercase/index.html | 4 +- .../string/tolocaleuppercase/index.html | 4 +- .../string/tolowercase/index.html | 2 +- .../global_objects/string/tosource/index.html | 2 +- .../global_objects/string/tostring/index.html | 2 +- .../string/touppercase/index.html | 2 +- .../global_objects/string/trim/index.html | 2 +- .../global_objects/string/trimend/index.html | 6 +- .../string/trimstart/index.html | 8 +- .../global_objects/string/valueof/index.html | 2 +- .../symbol/@@toprimitive/index.html | 4 +- .../global_objects/symbol/for/index.html | 6 +- .../symbol/hasinstance/index.html | 6 +- .../global_objects/symbol/keyfor/index.html | 4 +- .../global_objects/symbol/replace/index.html | 2 +- .../global_objects/symbol/search/index.html | 2 +- .../global_objects/symbol/species/index.html | 2 +- .../global_objects/symbol/split/index.html | 2 +- .../global_objects/symbol/symbol/index.html | 10 +- .../symbol/toprimitive/index.html | 2 +- .../global_objects/symbol/tosource/index.html | 6 +- .../global_objects/symbol/tostring/index.html | 6 +- .../symbol/tostringtag/index.html | 10 +- .../symbol/unscopables/index.html | 4 +- .../global_objects/symbol/valueof/index.html | 4 +- .../typedarray/@@iterator/index.html | 6 +- .../global_objects/typedarray/at/index.html | 6 +- .../typedarray/buffer/index.html | 2 +- .../typedarray/bytelength/index.html | 2 +- .../typedarray/byteoffset/index.html | 2 +- .../typedarray/copywithin/index.html | 2 +- .../typedarray/entries/index.html | 6 +- .../typedarray/every/index.html | 6 +- .../global_objects/typedarray/fill/index.html | 6 +- .../typedarray/filter/index.html | 6 +- .../global_objects/typedarray/find/index.html | 4 +- .../typedarray/findindex/index.html | 6 +- .../typedarray/foreach/index.html | 4 +- .../global_objects/typedarray/from/index.html | 12 +- .../typedarray/includes/index.html | 2 +- .../global_objects/typedarray/index.html | 8 +- .../typedarray/indexof/index.html | 2 +- .../global_objects/typedarray/join/index.html | 6 +- .../global_objects/typedarray/keys/index.html | 6 +- .../typedarray/lastindexof/index.html | 2 +- .../global_objects/typedarray/map/index.html | 6 +- .../global_objects/typedarray/of/index.html | 4 +- .../typedarray/reduce/index.html | 4 +- .../typedarray/reduceright/index.html | 6 +- .../typedarray/reverse/index.html | 2 +- .../global_objects/typedarray/set/index.html | 2 +- .../typedarray/slice/index.html | 6 +- .../global_objects/typedarray/some/index.html | 8 +- .../global_objects/typedarray/sort/index.html | 2 +- .../typedarray/subarray/index.html | 4 +- .../typedarray/tolocalestring/index.html | 4 +- .../typedarray/tostring/index.html | 6 +- .../typedarray/values/index.html | 12 +- .../global_objects/typeerror/index.html | 4 +- .../typeerror/typeerror/index.html | 6 +- .../global_objects/uint16array/index.html | 2 +- .../uint16array/uint16array/index.html | 8 +- .../global_objects/uint32array/index.html | 2 +- .../uint32array/uint32array/index.html | 8 +- .../global_objects/uint8array/index.html | 2 +- .../uint8array/uint8array/index.html | 8 +- .../uint8clampedarray/index.html | 2 +- .../uint8clampedarray/index.html | 8 +- .../global_objects/undefined/index.html | 14 +- .../global_objects/unescape/index.html | 4 +- .../global_objects/uneval/index.html | 4 +- .../global_objects/urierror/index.html | 4 +- .../urierror/urierror/index.html | 6 +- .../global_objects/weakmap/clear/index.html | 2 +- .../global_objects/weakmap/delete/index.html | 4 +- .../global_objects/weakmap/get/index.html | 4 +- .../global_objects/weakmap/has/index.html | 4 +- .../global_objects/weakmap/index.html | 4 +- .../global_objects/weakmap/set/index.html | 4 +- .../global_objects/weakmap/weakmap/index.html | 4 +- .../global_objects/weakref/deref/index.html | 4 +- .../global_objects/weakref/index.html | 2 +- .../global_objects/weakref/weakref/index.html | 4 +- .../global_objects/weakset/add/index.html | 2 +- .../global_objects/weakset/clear/index.html | 2 +- .../global_objects/weakset/delete/index.html | 4 +- .../global_objects/weakset/has/index.html | 4 +- .../global_objects/weakset/index.html | 4 +- .../global_objects/weakset/weakset/index.html | 4 +- .../webassembly/compile/index.html | 2 +- .../compileerror/compileerror/index.html | 2 +- .../webassembly/compilestreaming/index.html | 2 +- .../webassembly/global/global/index.html | 4 +- .../webassembly/global/index.html | 2 +- .../webassembly/instance/exports/index.html | 2 +- .../webassembly/instance/instance/index.html | 2 +- .../webassembly/instantiate/index.html | 10 +- .../instantiatestreaming/index.html | 2 +- .../linkerror/linkerror/index.html | 2 +- .../webassembly/memory/grow/index.html | 2 +- .../webassembly/memory/index.html | 8 +- .../webassembly/memory/memory/index.html | 8 +- .../module/customsections/index.html | 2 +- .../webassembly/module/exports/index.html | 2 +- .../webassembly/module/imports/index.html | 2 +- .../webassembly/module/index.html | 4 +- .../webassembly/module/module/index.html | 2 +- .../runtimeerror/runtimeerror/index.html | 2 +- .../webassembly/table/get/index.html | 2 +- .../webassembly/table/grow/index.html | 2 +- .../webassembly/table/length/index.html | 2 +- .../webassembly/table/set/index.html | 2 +- .../webassembly/table/table/index.html | 2 +- .../webassembly/validate/index.html | 2 +- .../reference/iteration_protocols/index.html | 30 ++-- .../reference/lexical_grammar/index.html | 62 +++---- .../reference/operators/addition/index.html | 6 +- .../operators/addition_assignment/index.html | 4 +- .../reference/operators/assignment/index.html | 4 +- .../operators/async_function/index.html | 2 +- .../reference/operators/await/index.html | 14 +- .../operators/bitwise_and/index.html | 8 +- .../bitwise_and_assignment/index.html | 4 +- .../operators/bitwise_not/index.html | 8 +- .../reference/operators/bitwise_or/index.html | 8 +- .../bitwise_or_assignment/index.html | 4 +- .../operators/bitwise_xor/index.html | 8 +- .../bitwise_xor_assignment/index.html | 4 +- .../reference/operators/class/index.html | 2 +- .../operators/comma_operator/index.html | 8 +- .../operators/conditional_operator/index.html | 8 +- .../reference/operators/decrement/index.html | 6 +- .../reference/operators/delete/index.html | 4 +- .../destructuring_assignment/index.html | 54 +++--- .../reference/operators/division/index.html | 6 +- .../operators/division_assignment/index.html | 4 +- .../reference/operators/equality/index.html | 12 +- .../operators/exponentiation/index.html | 12 +- .../exponentiation_assignment/index.html | 4 +- .../reference/operators/function/index.html | 2 +- .../operators/function_star_/index.html | 2 +- .../operators/greater_than/index.html | 12 +- .../greater_than_or_equal/index.html | 12 +- .../reference/operators/grouping/index.html | 4 +- .../reference/operators/in/index.html | 18 +- .../reference/operators/increment/index.html | 6 +- .../reference/operators/inequality/index.html | 14 +- .../reference/operators/instanceof/index.html | 12 +- .../reference/operators/left_shift/index.html | 6 +- .../left_shift_assignment/index.html | 4 +- .../reference/operators/less_than/index.html | 12 +- .../operators/less_than_or_equal/index.html | 12 +- .../operators/logical_and/index.html | 20 +-- .../logical_and_assignment/index.html | 8 +- .../operators/logical_not/index.html | 10 +- .../logical_nullish_assignment/index.html | 8 +- .../reference/operators/logical_or/index.html | 20 +-- .../logical_or_assignment/index.html | 10 +- .../operators/multiplication/index.html | 8 +- .../multiplication_assignment/index.html | 4 +- .../reference/operators/new.target/index.html | 2 +- .../reference/operators/new/index.html | 24 +-- .../nullish_coalescing_operator/index.html | 18 +- .../operators/object_initializer/index.html | 34 ++-- .../operators/operator_precedence/index.html | 30 ++-- .../operators/optional_chaining/index.html | 28 +-- .../operators/pipeline_operator/index.html | 8 +- .../operators/property_accessors/index.html | 2 +- .../reference/operators/remainder/index.html | 10 +- .../operators/remainder_assignment/index.html | 4 +- .../operators/right_shift/index.html | 8 +- .../right_shift_assignment/index.html | 4 +- .../operators/spread_syntax/index.html | 40 ++--- .../operators/strict_equality/index.html | 8 +- .../operators/strict_inequality/index.html | 12 +- .../operators/subtraction/index.html | 6 +- .../subtraction_assignment/index.html | 4 +- .../reference/operators/super/index.html | 12 +- .../reference/operators/this/index.html | 2 +- .../reference/operators/typeof/index.html | 22 +-- .../operators/unary_negation/index.html | 6 +- .../reference/operators/unary_plus/index.html | 6 +- .../operators/unsigned_right_shift/index.html | 8 +- .../index.html | 4 +- .../reference/operators/void/index.html | 10 +- .../reference/operators/yield/index.html | 8 +- .../operators/yield_star_/index.html | 2 +- .../statements/async_function/index.html | 22 +-- .../reference/statements/block/index.html | 4 +- .../reference/statements/break/index.html | 14 +- .../reference/statements/class/index.html | 2 +- .../reference/statements/const/index.html | 12 +- .../reference/statements/continue/index.html | 8 +- .../reference/statements/debugger/index.html | 4 +- .../statements/do...while/index.html | 2 +- .../reference/statements/empty/index.html | 8 +- .../reference/statements/export/index.html | 40 ++--- .../statements/for-await...of/index.html | 14 +- .../reference/statements/for...in/index.html | 8 +- .../reference/statements/for...of/index.html | 2 +- .../reference/statements/for/index.html | 12 +- .../reference/statements/function/index.html | 12 +- .../statements/function_star_/index.html | 22 +-- .../reference/statements/if...else/index.html | 2 +- .../statements/import.meta/index.html | 2 +- .../reference/statements/import/index.html | 36 ++-- .../reference/statements/label/index.html | 18 +- .../reference/statements/let/index.html | 32 ++-- .../reference/statements/return/index.html | 16 +- .../reference/statements/switch/index.html | 16 +- .../reference/statements/throw/index.html | 6 +- .../statements/try...catch/index.html | 20 +-- .../reference/statements/var/index.html | 32 ++-- .../reference/statements/while/index.html | 2 +- .../reference/statements/with/index.html | 8 +- .../reference/template_literals/index.html | 32 ++-- .../advanced_example/index.html | 2 +- .../basic_example/index.html | 6 +- 1000 files changed, 3288 insertions(+), 3288 deletions(-) diff --git a/files/en-us/web/api/abstractrange/collapsed/index.html b/files/en-us/web/api/abstractrange/collapsed/index.html index 22298dfbb3a8d2c..d43f92d26c57e10 100644 --- a/files/en-us/web/api/abstractrange/collapsed/index.html +++ b/files/en-us/web/api/abstractrange/collapsed/index.html @@ -18,7 +18,7 @@

Syntax

-
var isCollapsed = range.collapsed
+
var isCollapsed = range.collapsed

Value

diff --git a/files/en-us/web/api/abstractrange/endcontainer/index.html b/files/en-us/web/api/abstractrange/endcontainer/index.html index 943315fdfd0ff04..492e98c5798e317 100644 --- a/files/en-us/web/api/abstractrange/endcontainer/index.html +++ b/files/en-us/web/api/abstractrange/endcontainer/index.html @@ -22,7 +22,7 @@

Syntax

-
var endNode = range.endContainer
+
var endNode = range.endContainer
 

Value

diff --git a/files/en-us/web/api/abstractrange/endoffset/index.html b/files/en-us/web/api/abstractrange/endoffset/index.html index dbf057c903300c3..a27a6c49376b9ad 100644 --- a/files/en-us/web/api/abstractrange/endoffset/index.html +++ b/files/en-us/web/api/abstractrange/endoffset/index.html @@ -20,7 +20,7 @@

Syntax

-
var endOffset = range.endOffset;
+
var endOffset = range.endOffset;

Value

diff --git a/files/en-us/web/api/abstractrange/startcontainer/index.html b/files/en-us/web/api/abstractrange/startcontainer/index.html index e4e8640306e888b..35bb0a4e68245ef 100644 --- a/files/en-us/web/api/abstractrange/startcontainer/index.html +++ b/files/en-us/web/api/abstractrange/startcontainer/index.html @@ -19,7 +19,7 @@

Syntax

-
var startNode = range.startContainer
+
var startNode = range.startContainer
 

Value

diff --git a/files/en-us/web/api/abstractrange/startoffset/index.html b/files/en-us/web/api/abstractrange/startoffset/index.html index ec2d68f25c157df..fb3560b106df3fa 100644 --- a/files/en-us/web/api/abstractrange/startoffset/index.html +++ b/files/en-us/web/api/abstractrange/startoffset/index.html @@ -19,7 +19,7 @@

Syntax

-
var startOffset = range.startOffset
+
var startOffset = range.startOffset
 

Value

diff --git a/files/en-us/web/api/beforeinstallpromptevent/prompt/index.html b/files/en-us/web/api/beforeinstallpromptevent/prompt/index.html index bdafc04b5ca2655..38fb8717433181e 100644 --- a/files/en-us/web/api/beforeinstallpromptevent/prompt/index.html +++ b/files/en-us/web/api/beforeinstallpromptevent/prompt/index.html @@ -15,7 +15,7 @@

Syntax

-
BeforeInstallPromptEvent.prompt()
+
BeforeInstallPromptEvent.prompt()

Parameters

diff --git a/files/en-us/web/api/clipboard/read/index.html b/files/en-us/web/api/clipboard/read/index.html index ef78e4afd7857d8..bcbfd33adc59abf 100644 --- a/files/en-us/web/api/clipboard/read/index.html +++ b/files/en-us/web/api/clipboard/read/index.html @@ -39,7 +39,7 @@

Syntax

var promise = navigator.clipboard.read();
+ class="brush: js">var promise = navigator.clipboard.read();

Parameters

@@ -59,7 +59,7 @@

Example

image, an error message is presented. Otherwise, an image element referred to using the variable imgElem has its source replaced with the clipboard's contents.

-
// First, ask the Permissions API if we have some kind of access to
+
// First, ask the Permissions API if we have some kind of access to
 // the "clipboard-read" feature.
 
 navigator.permissions.query({name: "clipboard-read"}).then(result => {
diff --git a/files/en-us/web/api/clipboard/readtext/index.html b/files/en-us/web/api/clipboard/readtext/index.html
index 9b385a6c6041556..07c19f2c8ba1d2b 100644
--- a/files/en-us/web/api/clipboard/readtext/index.html
+++ b/files/en-us/web/api/clipboard/readtext/index.html
@@ -29,7 +29,7 @@
 

Syntax

var promise = navigator.clipboard.readText()
+ class="brush: js">var promise = navigator.clipboard.readText()

Parameters

@@ -51,7 +51,7 @@

Example

This example retrieves the textual contents of the clipboard and inserts the returned text into an element's contents.

-
navigator.clipboard.readText().then(
+
navigator.clipboard.readText().then(
   clipText => document.getElementById("outbox").innerText = clipText);

Specifications

diff --git a/files/en-us/web/api/clipboard/write/index.html b/files/en-us/web/api/clipboard/write/index.html index cfa0b52e0aafedd..c74fcb5775a61e3 100644 --- a/files/en-us/web/api/clipboard/write/index.html +++ b/files/en-us/web/api/clipboard/write/index.html @@ -36,7 +36,7 @@

Syntax

var promise = navigator.clipboard.write(data)
+ class="brush: js">var promise = navigator.clipboard.write(data)

Parameters

@@ -57,7 +57,7 @@

Example

This example function replaces the current contents of the clipboard with a specified string.

-
function setClipboard(text) {
+
function setClipboard(text) {
   let data = [new ClipboardItem({ "text/plain": text })];
 
   navigator.clipboard.write(data).then(function() {
@@ -78,7 +78,7 @@ 

Example

Example of copying canvas contents to the clipboard

-
function copyCanvasContentsToClipboard(canvas, onDone, onError) {
+
function copyCanvasContentsToClipboard(canvas, onDone, onError) {
   canvas.toBlob(function (blob) {
     let data = [new ClipboardItem({ [blob.type]: blob })];
 
diff --git a/files/en-us/web/api/clipboard/writetext/index.html b/files/en-us/web/api/clipboard/writetext/index.html
index 50059294f27b97c..033a770857f71c8 100644
--- a/files/en-us/web/api/clipboard/writetext/index.html
+++ b/files/en-us/web/api/clipboard/writetext/index.html
@@ -37,7 +37,7 @@
 

Syntax

var promise = navigator.clipboard.writeText(newClipText)
+ class="brush: js">var promise = navigator.clipboard.writeText(newClipText)

Parameters

@@ -56,7 +56,7 @@

Example

This example sets the clipboard's contents to the string "<empty clipboard>".

-
navigator.clipboard.writeText("<empty clipboard>").then(function() {
+
navigator.clipboard.writeText("<empty clipboard>").then(function() {
   /* clipboard successfully set */
 }, function() {
   /* clipboard write failed */
diff --git a/files/en-us/web/api/console/assert/index.html b/files/en-us/web/api/console/assert/index.html
index bd9d450e1c8b1a2..78206a3dbed34bc 100644
--- a/files/en-us/web/api/console/assert/index.html
+++ b/files/en-us/web/api/console/assert/index.html
@@ -19,7 +19,7 @@
 
 

Syntax

-
console.assert(assertion, obj1 [, obj2, ..., objN]);
+
console.assert(assertion, obj1 [, obj2, ..., objN]);
 console.assert(assertion, msg [, subst1, ..., substN]); // C-like message formatting
 
diff --git a/files/en-us/web/api/console/clear/index.html b/files/en-us/web/api/console/clear/index.html index c9b110e2844b127..39c087ebb02b6c4 100644 --- a/files/en-us/web/api/console/clear/index.html +++ b/files/en-us/web/api/console/clear/index.html @@ -16,7 +16,7 @@

Syntax

-
console.clear();
+
console.clear();
 

Specifications

diff --git a/files/en-us/web/api/console/count/index.html b/files/en-us/web/api/console/count/index.html index c1a5a291beab367..5c2cddb100fc6c1 100644 --- a/files/en-us/web/api/console/count/index.html +++ b/files/en-us/web/api/console/count/index.html @@ -19,7 +19,7 @@

Syntax

-
console.count([label]);
+
console.count([label]);

Parameters

diff --git a/files/en-us/web/api/console/countreset/index.html b/files/en-us/web/api/console/countreset/index.html index b3db0b9acdfeb57..bc3a5837cab4ae3 100644 --- a/files/en-us/web/api/console/countreset/index.html +++ b/files/en-us/web/api/console/countreset/index.html @@ -20,7 +20,7 @@

Syntax

-
console.countReset([label]);
+
console.countReset([label]);
 

Parameters

diff --git a/files/en-us/web/api/console/debug/index.html b/files/en-us/web/api/console/debug/index.html index 7b7abab95289578..b5d7941a6f38068 100644 --- a/files/en-us/web/api/console/debug/index.html +++ b/files/en-us/web/api/console/debug/index.html @@ -26,7 +26,7 @@

Syntax

-
console.debug(obj1 [, obj2, ..., objN]);
+
console.debug(obj1 [, obj2, ..., objN]);
 console.debug(msg [, subst1, ..., substN]);
 
diff --git a/files/en-us/web/api/console/dir/index.html b/files/en-us/web/api/console/dir/index.html index d3da64e2d75ce03..58b50f23262630f 100644 --- a/files/en-us/web/api/console/dir/index.html +++ b/files/en-us/web/api/console/dir/index.html @@ -29,7 +29,7 @@

Syntax

-
console.dir(object);
+
console.dir(object);
 

Parameters

diff --git a/files/en-us/web/api/console/dirxml/index.html b/files/en-us/web/api/console/dirxml/index.html index 73bf46f9328f82a..3344892dfb1c2ad 100644 --- a/files/en-us/web/api/console/dirxml/index.html +++ b/files/en-us/web/api/console/dirxml/index.html @@ -18,7 +18,7 @@

Syntax

-
console.dirxml(object);
+
console.dirxml(object);
 

Parameters

diff --git a/files/en-us/web/api/console/error/index.html b/files/en-us/web/api/console/error/index.html index 281c342b51f20b8..004f9dcb11d3f55 100644 --- a/files/en-us/web/api/console/error/index.html +++ b/files/en-us/web/api/console/error/index.html @@ -17,7 +17,7 @@

Syntax

-
console.error(obj1 [, obj2, ..., objN]);
+
console.error(obj1 [, obj2, ..., objN]);
 console.error(msg [, subst1, ..., substN]);
 
diff --git a/files/en-us/web/api/console/group/index.html b/files/en-us/web/api/console/group/index.html index f4bf39c626afde7..3de01dc7b8ccc34 100644 --- a/files/en-us/web/api/console/group/index.html +++ b/files/en-us/web/api/console/group/index.html @@ -19,7 +19,7 @@

Syntax

-
console.group([label]);
+
console.group([label]);
 

Parameters

diff --git a/files/en-us/web/api/console/groupcollapsed/index.html b/files/en-us/web/api/console/groupcollapsed/index.html index 9a7932856f09a30..06cf349c0dbe19d 100644 --- a/files/en-us/web/api/console/groupcollapsed/index.html +++ b/files/en-us/web/api/console/groupcollapsed/index.html @@ -27,7 +27,7 @@

Syntax

-
console.groupCollapsed([label]);
+
console.groupCollapsed([label]);
 

Parameters

diff --git a/files/en-us/web/api/console/groupend/index.html b/files/en-us/web/api/console/groupend/index.html index 8538872bee9a7c0..66f0f62054082b2 100644 --- a/files/en-us/web/api/console/groupend/index.html +++ b/files/en-us/web/api/console/groupend/index.html @@ -21,7 +21,7 @@

Syntax

-
console.groupEnd();
+
console.groupEnd();
 

Parameters

diff --git a/files/en-us/web/api/console/index.html b/files/en-us/web/api/console/index.html index 96725e1ca240e66..022449390db3c4c 100644 --- a/files/en-us/web/api/console/index.html +++ b/files/en-us/web/api/console/index.html @@ -15,7 +15,7 @@

The console object can be accessed from any global object. {{domxref("Window")}} on browsing scopes and {{domxref("WorkerGlobalScope")}} as specific variants in workers via the property console. It's exposed as {{domxref("Window.console")}}, and can be referenced as console. For example:

-
console.log("Failed to open the specified link")
+
console.log("Failed to open the specified link")

This page documents the {{anch("Methods")}} available on the console object and gives a few {{anch("Usage")}} examples.

@@ -88,25 +88,25 @@

Outputting a single object

The simplest way to use the logging methods is to output a single object:

-
var someObject = { str: "Some text", id: 5 };
+
var someObject = { str: "Some text", id: 5 };
 console.log(someObject);
 

The output looks something like this:

-
[09:27:13.475] ({str:"Some text", id:5})
+
[09:27:13.475] ({str:"Some text", id:5})

Outputting multiple objects

You can also output multiple objects by listing them when calling the logging method, like this:

-
var car = "Dodge Charger";
+
var car = "Dodge Charger";
 var someObject = { str: "Some text", id: 5 };
 console.info("My first car was a", car, ". The object is:", someObject);

This output will look like this:

-
[09:28:22.711] My first car was a Dodge Charger . The object is: ({str:"Some text", id:5})
+
[09:28:22.711] My first car was a Dodge Charger . The object is: ({str:"Some text", id:5})
 

Using string substitutions

@@ -130,14 +130,14 @@

Using string substitutions

Each of these pulls the next argument after the format string off the parameter list. For example:

-
for (var i=0; i<5; i++) {
+
for (var i=0; i<5; i++) {
   console.log("Hello, %s. You've called me %d times.", "Bob", i+1);
 }
 

The output looks like this:

-
[13:14:13.481] Hello, Bob. You've called me 1 times.
+
[13:14:13.481] Hello, Bob. You've called me 1 times.
 [13:14:13.483] Hello, Bob. You've called me 2 times.
 [13:14:13.485] Hello, Bob. You've called me 3 times.
 [13:14:13.487] Hello, Bob. You've called me 4 times.
@@ -148,7 +148,7 @@ 

Styling console output

You can use the %c directive to apply a CSS style to console output:

-
console.log("This is %cMy stylish message", "color: yellow; font-style: italic; background-color: blue;padding: 2px");
+
console.log("This is %cMy stylish message", "color: yellow; font-style: italic; background-color: blue;padding: 2px");

The text before the directive will not be affected, but the text after the directive will be styled using the CSS declarations in the parameter.

@@ -187,7 +187,7 @@

Using groups in the console

To exit the current group, call console.groupEnd(). For example, given this code:

-
console.log("This is the outer level");
+
console.log("This is the outer level");
 console.group("First group");
 console.log("In the first group");
 console.group("Second group");
@@ -209,7 +209,7 @@ 

Timers

For example, given this code:

-
console.time("answer time");
+
console.time("answer time");
 alert("Click to continue");
 console.timeLog("answer time");
 alert("Do a bunch of other stuff...");
@@ -228,7 +228,7 @@ 

Stack traces

The console object also supports outputting a stack trace; this will show you the call path taken to reach the point at which you call {{domxref("console.trace()")}}. Given code like this:

-
function foo() {
+
function foo() {
   function bar() {
     console.trace();
   }
diff --git a/files/en-us/web/api/console/info/index.html b/files/en-us/web/api/console/info/index.html
index 7c36d3bbf6026a2..cd173ae262db286 100644
--- a/files/en-us/web/api/console/info/index.html
+++ b/files/en-us/web/api/console/info/index.html
@@ -18,7 +18,7 @@
 
 

Syntax

-
console.info(obj1 [, obj2, ..., objN]);
+
console.info(obj1 [, obj2, ..., objN]);
 console.info(msg [, subst1, ..., substN]);
 
diff --git a/files/en-us/web/api/console/log/index.html b/files/en-us/web/api/console/log/index.html index a09e8979b7eed55..d3936f23cdbda64 100644 --- a/files/en-us/web/api/console/log/index.html +++ b/files/en-us/web/api/console/log/index.html @@ -26,7 +26,7 @@

Syntax

-
console.log(obj1 [, obj2, ..., objN]);
+
console.log(obj1 [, obj2, ..., objN]);
 console.log(msg [, subst1, ..., substN]);
 
diff --git a/files/en-us/web/api/console/profile/index.html b/files/en-us/web/api/console/profile/index.html index fd0fd399ce2648d..cde670956fa5460 100644 --- a/files/en-us/web/api/console/profile/index.html +++ b/files/en-us/web/api/console/profile/index.html @@ -27,7 +27,7 @@

Syntax

-
console.profile(profileName);
+
console.profile(profileName);
 

Parameters

diff --git a/files/en-us/web/api/console/profileend/index.html b/files/en-us/web/api/console/profileend/index.html index 2dd14260ce9c2bf..cd2ffa0c21a42a1 100644 --- a/files/en-us/web/api/console/profileend/index.html +++ b/files/en-us/web/api/console/profileend/index.html @@ -39,7 +39,7 @@

Syntax

-
console.profileEnd(profileName);
+
console.profileEnd(profileName);
 

Parameters

diff --git a/files/en-us/web/api/console/table/index.html b/files/en-us/web/api/console/table/index.html index 09a4f8bd02f7470..1dd199353edddd4 100644 --- a/files/en-us/web/api/console/table/index.html +++ b/files/en-us/web/api/console/table/index.html @@ -126,7 +126,7 @@

Sorting columns

Syntax

-
console.table(data [, columns]);
+
console.table(data [, columns]);
 

Parameters

diff --git a/files/en-us/web/api/console/time/index.html b/files/en-us/web/api/console/time/index.html index 24f794a9c6c216c..c39907c23f62a3e 100644 --- a/files/en-us/web/api/console/time/index.html +++ b/files/en-us/web/api/console/time/index.html @@ -24,7 +24,7 @@

Syntax

-
console.time(label);
+
console.time(label);
 

Parameters

diff --git a/files/en-us/web/api/console/timeend/index.html b/files/en-us/web/api/console/timeend/index.html index 878e4cda11e070c..54ff83211d83d59 100644 --- a/files/en-us/web/api/console/timeend/index.html +++ b/files/en-us/web/api/console/timeend/index.html @@ -21,7 +21,7 @@

Syntax

-
console.timeEnd(label);
+
console.timeEnd(label);
 

Parameters

diff --git a/files/en-us/web/api/console/timelog/index.html b/files/en-us/web/api/console/timelog/index.html index 71327c8ac56e476..b4698cca9bf77ec 100644 --- a/files/en-us/web/api/console/timelog/index.html +++ b/files/en-us/web/api/console/timelog/index.html @@ -22,7 +22,7 @@

Syntax

-
console.timeLog(label);
+
console.timeLog(label);

Parameters

diff --git a/files/en-us/web/api/console/timestamp/index.html b/files/en-us/web/api/console/timestamp/index.html index d1310be2b1009ff..bad6231c9b2c0a3 100644 --- a/files/en-us/web/api/console/timestamp/index.html +++ b/files/en-us/web/api/console/timestamp/index.html @@ -25,7 +25,7 @@

Syntax

-
console.timeStamp(label);
+
console.timeStamp(label);
 

Parameters

diff --git a/files/en-us/web/api/console/trace/index.html b/files/en-us/web/api/console/trace/index.html index 49be0e8ad15078a..bd9abb732608247 100644 --- a/files/en-us/web/api/console/trace/index.html +++ b/files/en-us/web/api/console/trace/index.html @@ -28,7 +28,7 @@

Syntax

-
console.trace( [...any, ...data ]);
+
console.trace( [...any, ...data ]);
 

Parameters

diff --git a/files/en-us/web/api/console/warn/index.html b/files/en-us/web/api/console/warn/index.html index 7fe9d855165ca1a..e1d5bc08b9428b2 100644 --- a/files/en-us/web/api/console/warn/index.html +++ b/files/en-us/web/api/console/warn/index.html @@ -18,7 +18,7 @@

Syntax

-
console.warn(obj1 [, obj2, ..., objN]);
+
console.warn(obj1 [, obj2, ..., objN]);
 console.warn(msg [, subst1, ..., substN]);
 
diff --git a/files/en-us/web/api/countqueuingstrategy/countqueuingstrategy/index.html b/files/en-us/web/api/countqueuingstrategy/countqueuingstrategy/index.html index ce2948a0dda5b49..3a9f6aa82c29582 100644 --- a/files/en-us/web/api/countqueuingstrategy/countqueuingstrategy/index.html +++ b/files/en-us/web/api/countqueuingstrategy/countqueuingstrategy/index.html @@ -17,7 +17,7 @@

Syntax

var countQueuingStrategy = new CountQueuingStrategy({highWaterMark});
+ class="brush: js">var countQueuingStrategy = new CountQueuingStrategy({highWaterMark});

Parameters

diff --git a/files/en-us/web/api/countqueuingstrategy/size/index.html b/files/en-us/web/api/countqueuingstrategy/size/index.html index d1d67e1fcd1dc4d..a2f3d8ffc610f1d 100644 --- a/files/en-us/web/api/countqueuingstrategy/size/index.html +++ b/files/en-us/web/api/countqueuingstrategy/size/index.html @@ -19,7 +19,7 @@

Syntax

var size = countQueuingStrategy.size();
+ class="brush: js">var size = countQueuingStrategy.size();

Parameters

diff --git a/files/en-us/web/api/cssmathmax/cssmathmax/index.html b/files/en-us/web/api/cssmathmax/cssmathmax/index.html index 80edd0684a30ee5..60f31b313f89d04 100644 --- a/files/en-us/web/api/cssmathmax/cssmathmax/index.html +++ b/files/en-us/web/api/cssmathmax/cssmathmax/index.html @@ -19,7 +19,7 @@

Syntax

var CSSMathMax = new CSSMathMax(args);
+ class="brush: js">var CSSMathMax = new CSSMathMax(args);

Parameters

diff --git a/files/en-us/web/api/cssmathmax/values/index.html b/files/en-us/web/api/cssmathmax/values/index.html index af831a68005289e..73662055c6c23a7 100644 --- a/files/en-us/web/api/cssmathmax/values/index.html +++ b/files/en-us/web/api/cssmathmax/values/index.html @@ -19,7 +19,7 @@

Syntax

var cssNumericArray = CSSMathMax.values;
+ class="brush: js">var cssNumericArray = CSSMathMax.values;

Value

diff --git a/files/en-us/web/api/cssmathvalue/operator/index.html b/files/en-us/web/api/cssmathvalue/operator/index.html index 21b5cf367583485..47d4d86d8a29ea2 100644 --- a/files/en-us/web/api/cssmathvalue/operator/index.html +++ b/files/en-us/web/api/cssmathvalue/operator/index.html @@ -21,7 +21,7 @@

Syntax

-
var aString = CSSMathValue.operator;
+
var aString = CSSMathValue.operator;

Value

@@ -73,18 +73,18 @@

Examples

then console.log() the operator.

-
<div>My width has a <code>calc()</code> function</div>
+
<div>My width has a <code>calc()</code> function</div>
 

We assign a width with a calculation

-
div {
+
div {
   width: calc(50% - 0.5vw);
 }

We add the JavaScript

-
const styleMap = document.querySelector('div').computedStyleMap();
+
const styleMap = document.querySelector('div').computedStyleMap();
 
 console.log( styleMap.get('width') );                   // CSSMathSum {values: CSSNumericArray, operator: "sum"}
 console.log( styleMap.get('width').values );            // CSSNumericArray {0: CSSUnitValue, 1: CSSMathNegate, length: 2}
diff --git a/files/en-us/web/api/cssprimitivevalue/getrgbcolorvalue/index.html b/files/en-us/web/api/cssprimitivevalue/getrgbcolorvalue/index.html
index ed4bfab9fc06611..b3bd327102b9587 100644
--- a/files/en-us/web/api/cssprimitivevalue/getrgbcolorvalue/index.html
+++ b/files/en-us/web/api/cssprimitivevalue/getrgbcolorvalue/index.html
@@ -18,7 +18,7 @@
 

Syntax

var rgbColorValue = cssPrimitiveValue.getRGBColorValue();
+ class="brush: js">var rgbColorValue = cssPrimitiveValue.getRGBColorValue();

Return value

diff --git a/files/en-us/web/api/cssprimitivevalue/setfloatvalue/index.html b/files/en-us/web/api/cssprimitivevalue/setfloatvalue/index.html index 5be0bbd4c09eb23..b8184ce14197716 100644 --- a/files/en-us/web/api/cssprimitivevalue/setfloatvalue/index.html +++ b/files/en-us/web/api/cssprimitivevalue/setfloatvalue/index.html @@ -18,7 +18,7 @@

Syntax

cssPrimitiveValue.setFloatValue(unitType, floatValue);
+ class="brush: js">cssPrimitiveValue.setFloatValue(unitType, floatValue);

Parameters

diff --git a/files/en-us/web/api/cssprimitivevalue/setstringvalue/index.html b/files/en-us/web/api/cssprimitivevalue/setstringvalue/index.html index 4311257b4a9717d..dc5c2754932a290 100644 --- a/files/en-us/web/api/cssprimitivevalue/setstringvalue/index.html +++ b/files/en-us/web/api/cssprimitivevalue/setstringvalue/index.html @@ -18,7 +18,7 @@

Syntax

cssPrimitiveValue.setStringValue(stringType, stringValue);
+ class="brush: js">cssPrimitiveValue.setStringValue(stringType, stringValue);

Parameters

diff --git a/files/en-us/web/api/csspseudoelement/element/index.html b/files/en-us/web/api/csspseudoelement/element/index.html index 45fab0aa5b8d278..fbe2c82a73d2ea8 100644 --- a/files/en-us/web/api/csspseudoelement/element/index.html +++ b/files/en-us/web/api/csspseudoelement/element/index.html @@ -17,7 +17,7 @@

Syntax

-
var originatingElement = cssPseudoElement.element;
+
var originatingElement = cssPseudoElement.element;
 

Value

diff --git a/files/en-us/web/api/csspseudoelement/type/index.html b/files/en-us/web/api/csspseudoelement/type/index.html index ad4c039d6cfc45b..a969806e3563f0a 100644 --- a/files/en-us/web/api/csspseudoelement/type/index.html +++ b/files/en-us/web/api/csspseudoelement/type/index.html @@ -18,7 +18,7 @@

Syntax

-
var typeOfPseudoElement = cssPseudoElement.type;
+
var typeOfPseudoElement = cssPseudoElement.type;
 

Value

diff --git a/files/en-us/web/api/deviceorientationevent/absolute/index.html b/files/en-us/web/api/deviceorientationevent/absolute/index.html index cae22d2e80f33bc..7f4405002a85f72 100644 --- a/files/en-us/web/api/deviceorientationevent/absolute/index.html +++ b/files/en-us/web/api/deviceorientationevent/absolute/index.html @@ -20,7 +20,7 @@

Syntax

-
var absolute = instanceOfDeviceOrientationEvent.absolute;
+
var absolute = instanceOfDeviceOrientationEvent.absolute;
 

On return, absolute is true if the orientation data diff --git a/files/en-us/web/api/deviceorientationevent/alpha/index.html b/files/en-us/web/api/deviceorientationevent/alpha/index.html index c7bb484a4098fad..ec18aa7a1c4d46c 100644 --- a/files/en-us/web/api/deviceorientationevent/alpha/index.html +++ b/files/en-us/web/api/deviceorientationevent/alpha/index.html @@ -20,7 +20,7 @@

Syntax

-
var alpha = instanceOfDeviceOrientationEvent.alpha;
+
var alpha = instanceOfDeviceOrientationEvent.alpha;
 

Specifications

diff --git a/files/en-us/web/api/deviceorientationevent/beta/index.html b/files/en-us/web/api/deviceorientationevent/beta/index.html index c5ca984d633b85f..6937fa20200ff88 100644 --- a/files/en-us/web/api/deviceorientationevent/beta/index.html +++ b/files/en-us/web/api/deviceorientationevent/beta/index.html @@ -22,7 +22,7 @@

Syntax

var beta = instanceOfDeviceOrientationEvent.beta;
+ class="brush: js">var beta = instanceOfDeviceOrientationEvent.beta;

Specifications

diff --git a/files/en-us/web/api/deviceorientationevent/deviceorientationevent/index.html b/files/en-us/web/api/deviceorientationevent/deviceorientationevent/index.html index 0d0e425951e65c2..baae88ff3e1111d 100644 --- a/files/en-us/web/api/deviceorientationevent/deviceorientationevent/index.html +++ b/files/en-us/web/api/deviceorientationevent/deviceorientationevent/index.html @@ -17,7 +17,7 @@

Syntax

var deviceOrientationEvent = new DeviceOrientationEvent(type[, options])
+ class="brush: js">var deviceOrientationEvent = new DeviceOrientationEvent(type[, options])

Parameters

diff --git a/files/en-us/web/api/deviceorientationevent/gamma/index.html b/files/en-us/web/api/deviceorientationevent/gamma/index.html index 394dabac802df01..83832dbcdc70006 100644 --- a/files/en-us/web/api/deviceorientationevent/gamma/index.html +++ b/files/en-us/web/api/deviceorientationevent/gamma/index.html @@ -21,7 +21,7 @@

Syntax

-
var gamma = orientationEvent.gamma;
+
var gamma = orientationEvent.gamma;
 

Specifications

diff --git a/files/en-us/web/api/deviceorientationevent/index.html b/files/en-us/web/api/deviceorientationevent/index.html index 483eeb0498a336c..483830371797f9c 100644 --- a/files/en-us/web/api/deviceorientationevent/index.html +++ b/files/en-us/web/api/deviceorientationevent/index.html @@ -38,7 +38,7 @@

Properties

Example

-
window.addEventListener('deviceorientation', function(event) {
+
window.addEventListener('deviceorientation', function(event) {
   console.log(event.alpha + ' : ' + event.beta + ' : ' + event.gamma);
 });
diff --git a/files/en-us/web/api/eventlistener/handleevent/index.html b/files/en-us/web/api/eventlistener/handleevent/index.html index 37d0691bec00bbb..77a23025246dec4 100644 --- a/files/en-us/web/api/eventlistener/handleevent/index.html +++ b/files/en-us/web/api/eventlistener/handleevent/index.html @@ -26,7 +26,7 @@

Syntax

-
eventListener.handleEvent(event);
+
eventListener.handleEvent(event);
 

Parameters

diff --git a/files/en-us/web/api/filereader/abort/index.html b/files/en-us/web/api/filereader/abort/index.html index 44b0c80925925fe..90d0105bf0a6572 100644 --- a/files/en-us/web/api/filereader/abort/index.html +++ b/files/en-us/web/api/filereader/abort/index.html @@ -17,7 +17,7 @@

Syntax

-
instanceOfFileReader.abort();
+
instanceOfFileReader.abort();

Exceptions

diff --git a/files/en-us/web/api/filereader/error/index.html b/files/en-us/web/api/filereader/error/index.html index a186a0b5441ad81..e87dd097dda48cd 100644 --- a/files/en-us/web/api/filereader/error/index.html +++ b/files/en-us/web/api/filereader/error/index.html @@ -15,7 +15,7 @@

Syntax

-
var error = instanceOfFileReader.error
+
var error = instanceOfFileReader.error
 

Value

diff --git a/files/en-us/web/api/filereader/onabort/index.html b/files/en-us/web/api/filereader/onabort/index.html index e10bc3aa6c58729..f74108ad12aa236 100644 --- a/files/en-us/web/api/filereader/onabort/index.html +++ b/files/en-us/web/api/filereader/onabort/index.html @@ -12,7 +12,7 @@

Syntax

-
reader.onabort = function() { ... };
+
reader.onabort = function() { ... };

Browser compatibility

diff --git a/files/en-us/web/api/filereader/onerror/index.html b/files/en-us/web/api/filereader/onerror/index.html index 6c033c157a99c4e..5e954be1298234d 100644 --- a/files/en-us/web/api/filereader/onerror/index.html +++ b/files/en-us/web/api/filereader/onerror/index.html @@ -4,7 +4,7 @@ ---

The FileReader onerror handler receives an Event object, not an Error object, as a parameter, but an error can be accessed from the FileReader object, as instanceOfFileReader.error

-
// Callback from a <input type="file" onchange="onChange(event)">
+
// Callback from a <input type="file" onchange="onChange(event)">
 function onChange(event) {
   var file = event.target.files[0];
   var reader = new FileReader();
diff --git a/files/en-us/web/api/filereader/readasarraybuffer/index.html b/files/en-us/web/api/filereader/readasarraybuffer/index.html
index 4fc2d69d9e25bab..b4c35d2a572711c 100644
--- a/files/en-us/web/api/filereader/readasarraybuffer/index.html
+++ b/files/en-us/web/api/filereader/readasarraybuffer/index.html
@@ -30,7 +30,7 @@
 

Syntax

instanceOfFileReader.readAsArrayBuffer(blob);
+ class="brush: js">instanceOfFileReader.readAsArrayBuffer(blob);

Parameters

diff --git a/files/en-us/web/api/filereader/readasbinarystring/index.html b/files/en-us/web/api/filereader/readasbinarystring/index.html index fb9c6fc7cc2fedd..3c6fc676564beba 100644 --- a/files/en-us/web/api/filereader/readasbinarystring/index.html +++ b/files/en-us/web/api/filereader/readasbinarystring/index.html @@ -24,7 +24,7 @@

Syntax

instanceOfFileReader.readAsBinaryString(blob);
+ class="brush: js">instanceOfFileReader.readAsBinaryString(blob);

Parameters

diff --git a/files/en-us/web/api/filereader/readasdataurl/index.html b/files/en-us/web/api/filereader/readasdataurl/index.html index 14fa6eba5bdaad2..61f22f44fd21a09 100644 --- a/files/en-us/web/api/filereader/readasdataurl/index.html +++ b/files/en-us/web/api/filereader/readasdataurl/index.html @@ -28,7 +28,7 @@

Syntax

instanceOfFileReader.readAsDataURL(blob);
+ class="brush: js">instanceOfFileReader.readAsDataURL(blob);

Parameters

diff --git a/files/en-us/web/api/filereader/readastext/index.html b/files/en-us/web/api/filereader/readastext/index.html index a24a627dc08a2f8..e172ab8a420acab 100644 --- a/files/en-us/web/api/filereader/readastext/index.html +++ b/files/en-us/web/api/filereader/readastext/index.html @@ -26,7 +26,7 @@

Syntax

instanceOfFileReader.readAsText(blob[, encoding]);
+ class="brush: js">instanceOfFileReader.readAsText(blob[, encoding]);

Parameters

diff --git a/files/en-us/web/api/filereader/result/index.html b/files/en-us/web/api/filereader/result/index.html index 13b5faaa2d5afef..ec89765ce60bd1b 100644 --- a/files/en-us/web/api/filereader/result/index.html +++ b/files/en-us/web/api/filereader/result/index.html @@ -19,7 +19,7 @@

Syntax

-
var file = instanceOfFileReader.result
+
var file = instanceOfFileReader.result
 

Value

diff --git a/files/en-us/web/api/filesystemdirectoryhandle/entries/index.html b/files/en-us/web/api/filesystemdirectoryhandle/entries/index.html index 0e626a27948ef4b..d476821c48bbee5 100644 --- a/files/en-us/web/api/filesystemdirectoryhandle/entries/index.html +++ b/files/en-us/web/api/filesystemdirectoryhandle/entries/index.html @@ -20,7 +20,7 @@

Syntax

-
 FileSystemDirectoryHandle.entries();
+
 FileSystemDirectoryHandle.entries();

Parameters

diff --git a/files/en-us/web/api/filesystemdirectoryhandle/getdirectoryhandle/index.html b/files/en-us/web/api/filesystemdirectoryhandle/getdirectoryhandle/index.html index 5399423ad2725eb..820f2462dfb9ee7 100644 --- a/files/en-us/web/api/filesystemdirectoryhandle/getdirectoryhandle/index.html +++ b/files/en-us/web/api/filesystemdirectoryhandle/getdirectoryhandle/index.html @@ -20,7 +20,7 @@

Syntax

var FileSystemDirectoryHandle = FileSystemDirectoryHandle.getDirectoryHandle();
+ class="brush: js">var FileSystemDirectoryHandle = FileSystemDirectoryHandle.getDirectoryHandle();

Parameters

@@ -61,7 +61,7 @@

Examples

The following example returns a directory handle with the specified name, if the directory does not exist it is created.

-
const dirName = 'directoryToGetName';
+
const dirName = 'directoryToGetName';
 
 // assuming we have a directory handle: 'currentDirHandle'
 const subDir = currentDirHandle.getDirectoryHandle(dirName, {create: true});
diff --git a/files/en-us/web/api/filesystemdirectoryhandle/getfilehandle/index.html b/files/en-us/web/api/filesystemdirectoryhandle/getfilehandle/index.html index 07e6be1332d07ed..acd86122dcafdb7 100644 --- a/files/en-us/web/api/filesystemdirectoryhandle/getfilehandle/index.html +++ b/files/en-us/web/api/filesystemdirectoryhandle/getfilehandle/index.html @@ -19,7 +19,7 @@

Syntax

var FileSystemFileHandle = FileSystemDirectoryHandle.getFileHandle(name);
+ class="brush: js">var FileSystemFileHandle = FileSystemDirectoryHandle.getFileHandle(name);

Parameters

@@ -61,7 +61,7 @@

Examples

The following example returns a file handle with the specified name, if the file does not exist it is created.

-
const fileName = 'fileToGetName';
+
const fileName = 'fileToGetName';
 
 // assuming we have a directory handle: 'currentDirHandle'
 const fileHandle = currentDirHandle.getFileHandle(fileName, {create: true});
diff --git a/files/en-us/web/api/filesystemdirectoryhandle/index.html b/files/en-us/web/api/filesystemdirectoryhandle/index.html index 33ba95e0dbdd230..1ff08565f718f1d 100644 --- a/files/en-us/web/api/filesystemdirectoryhandle/index.html +++ b/files/en-us/web/api/filesystemdirectoryhandle/index.html @@ -43,14 +43,14 @@

Examples

The following example returns a directory handle with the specified name, if the directory does not exist it is created.

-
const dirName = 'directoryToGetName';
+
const dirName = 'directoryToGetName';
 
 // assuming we have a directory handle: 'currentDirHandle'
 const subDir = currentDirHandle.getDirectoryHandle(dirName, {create: true});

The following asynchronous function uses resolve() to find the path to a chosen file, relative to a specified directory handle.

-
async function returnPathDirectories(directoryHandle) {
+
async function returnPathDirectories(directoryHandle) {
 
   // Get a file handle by showing a file picker:
   const handle = await self.showOpenFilePicker();
diff --git a/files/en-us/web/api/filesystemdirectoryhandle/keys/index.html b/files/en-us/web/api/filesystemdirectoryhandle/keys/index.html
index 176463a51f9b017..7988f2b87bc95e1 100644
--- a/files/en-us/web/api/filesystemdirectoryhandle/keys/index.html
+++ b/files/en-us/web/api/filesystemdirectoryhandle/keys/index.html
@@ -18,7 +18,7 @@
 
 

Syntax

-
FileSystemDirectoryHandle.keys();
+
FileSystemDirectoryHandle.keys();

Parameters

diff --git a/files/en-us/web/api/filesystemdirectoryhandle/removeentry/index.html b/files/en-us/web/api/filesystemdirectoryhandle/removeentry/index.html index fdb8c45100e02ca..fd910e60e4b69ac 100644 --- a/files/en-us/web/api/filesystemdirectoryhandle/removeentry/index.html +++ b/files/en-us/web/api/filesystemdirectoryhandle/removeentry/index.html @@ -18,7 +18,7 @@

Syntax

FileSystemDirectoryHandle.removeEntry(name).then...
+ class="brush: js">FileSystemDirectoryHandle.removeEntry(name).then...

Parameters

@@ -58,7 +58,7 @@

Examples

The following example removes an entry within the directory handle.

-
const entryName = 'entryToRemove';
+
const entryName = 'entryToRemove';
 
 // assuming we have a directory handle: 'currentDirHandle'
 currentDirHandle.removeEntry(entryName).then( () => {
diff --git a/files/en-us/web/api/filesystemdirectoryhandle/resolve/index.html b/files/en-us/web/api/filesystemdirectoryhandle/resolve/index.html
index e93e6010907d817..48e0e573f6b1a76 100644
--- a/files/en-us/web/api/filesystemdirectoryhandle/resolve/index.html
+++ b/files/en-us/web/api/filesystemdirectoryhandle/resolve/index.html
@@ -19,7 +19,7 @@
 

Syntax

var pathArr = FileSystemDirectoryHandle.resolve(possibleDescendant);
+ class="brush: js">var pathArr = FileSystemDirectoryHandle.resolve(possibleDescendant);

Parameters

@@ -43,7 +43,7 @@

Examples

The following asynchronous function uses resolve() to find the path to a chosen file, relative to a specified directory handle.

-
async function returnPathDirectories(directoryHandle) {
+
async function returnPathDirectories(directoryHandle) {
 
   // Get a file handle by showing a file picker:
   const handle = await self.showOpenFilePicker();
diff --git a/files/en-us/web/api/filesystemdirectoryhandle/values/index.html b/files/en-us/web/api/filesystemdirectoryhandle/values/index.html
index 8db053d03e27f83..4fb1dba74390bce 100644
--- a/files/en-us/web/api/filesystemdirectoryhandle/values/index.html
+++ b/files/en-us/web/api/filesystemdirectoryhandle/values/index.html
@@ -19,7 +19,7 @@
 
 

Syntax

-
FileSystemDirectoryHandle.values();
+
FileSystemDirectoryHandle.values();

Parameters

diff --git a/files/en-us/web/api/htmliframeelement/allowpaymentrequest/index.html b/files/en-us/web/api/htmliframeelement/allowpaymentrequest/index.html index b43f302e3d4c047..9270bde627b1f89 100644 --- a/files/en-us/web/api/htmliframeelement/allowpaymentrequest/index.html +++ b/files/en-us/web/api/htmliframeelement/allowpaymentrequest/index.html @@ -20,7 +20,7 @@

Syntax

-
var allow = htmlIFrameElement.allowPaymentRequest
+
var allow = htmlIFrameElement.allowPaymentRequest

Value

diff --git a/files/en-us/web/api/htmliframeelement/csp/index.html b/files/en-us/web/api/htmliframeelement/csp/index.html index 64b9f8e9a0ced1d..333de00d7fcaed1 100644 --- a/files/en-us/web/api/htmliframeelement/csp/index.html +++ b/files/en-us/web/api/htmliframeelement/csp/index.html @@ -18,7 +18,7 @@

Syntax

-
var csp = HTMLIFrameElement.csp
+
var csp = HTMLIFrameElement.csp
 HTMLIFrameElement.csp = csp

Value

diff --git a/files/en-us/web/api/htmliframeelement/featurepolicy/index.html b/files/en-us/web/api/htmliframeelement/featurepolicy/index.html index f7dd2aeae2f3c13..484a4753b5b5175 100644 --- a/files/en-us/web/api/htmliframeelement/featurepolicy/index.html +++ b/files/en-us/web/api/htmliframeelement/featurepolicy/index.html @@ -19,7 +19,7 @@

Syntax

var policy = HTMLIFrameElement.featurePolicy
+ class="brush: js">var policy = HTMLIFrameElement.featurePolicy

Value

diff --git a/files/en-us/web/api/htmliframeelement/referrerpolicy/index.html b/files/en-us/web/api/htmliframeelement/referrerpolicy/index.html index 1e942a9617ad679..8978e42433b6760 100644 --- a/files/en-us/web/api/htmliframeelement/referrerpolicy/index.html +++ b/files/en-us/web/api/htmliframeelement/referrerpolicy/index.html @@ -18,7 +18,7 @@

Syntax

-
refStr = iframeElt.referrerPolicy;
+
refStr = iframeElt.referrerPolicy;
 iframeElt.referrerPolicy = refStr;

Values

diff --git a/files/en-us/web/api/htmliframeelement/src/index.html b/files/en-us/web/api/htmliframeelement/src/index.html index 3d898601bd0ccfb..cefe5f09d60de05 100644 --- a/files/en-us/web/api/htmliframeelement/src/index.html +++ b/files/en-us/web/api/htmliframeelement/src/index.html @@ -11,7 +11,7 @@

Syntax

-
refStr = iframeElt.src;
+
refStr = iframeElt.src;
 iframeElt.src= refStr;
 
diff --git a/files/en-us/web/api/htmllinkelement/as/index.html b/files/en-us/web/api/htmllinkelement/as/index.html index d8012942539a41f..39db10dd09caf85 100644 --- a/files/en-us/web/api/htmllinkelement/as/index.html +++ b/files/en-us/web/api/htmllinkelement/as/index.html @@ -21,7 +21,7 @@

Syntax

-
var as = HTMLLinkElement.as
+
var as = HTMLLinkElement.as
 HTMLLinkElement.as = as

Value

diff --git a/files/en-us/web/api/htmllinkelement/referrerpolicy/index.html b/files/en-us/web/api/htmllinkelement/referrerpolicy/index.html index 036a25d651066a3..5bc84652bc7791d 100644 --- a/files/en-us/web/api/htmllinkelement/referrerpolicy/index.html +++ b/files/en-us/web/api/htmllinkelement/referrerpolicy/index.html @@ -20,7 +20,7 @@

Syntax

-
DOMString HTMLLinkElement.referrerPolicy
+
DOMString HTMLLinkElement.referrerPolicy

Example

diff --git a/files/en-us/web/api/htmllinkelement/rel/index.html b/files/en-us/web/api/htmllinkelement/rel/index.html index 006f43ab923e479..70f83363f824d86 100644 --- a/files/en-us/web/api/htmllinkelement/rel/index.html +++ b/files/en-us/web/api/htmllinkelement/rel/index.html @@ -22,7 +22,7 @@

Syntax

-
var relstr = linkElt.rel;
+
var relstr = linkElt.rel;
 linkElt.rel = relstr;
 
diff --git a/files/en-us/web/api/htmllinkelement/rellist/index.html b/files/en-us/web/api/htmllinkelement/rellist/index.html index 1abf9c9dbd62eec..4459e8fa5069de7 100644 --- a/files/en-us/web/api/htmllinkelement/rellist/index.html +++ b/files/en-us/web/api/htmllinkelement/rellist/index.html @@ -23,7 +23,7 @@

Syntax

-
var relstr = linkElt.relList;
+
var relstr = linkElt.relList;
 

Example

diff --git a/files/en-us/web/api/htmlshadowelement/getdistributednodes/index.html b/files/en-us/web/api/htmlshadowelement/getdistributednodes/index.html index 996f870aaab7c26..bdb0a78736d269b 100644 --- a/files/en-us/web/api/htmlshadowelement/getdistributednodes/index.html +++ b/files/en-us/web/api/htmlshadowelement/getdistributednodes/index.html @@ -16,7 +16,7 @@

Syntax

-
var nodeList = object.getDistributedNodes()
+
var nodeList = object.getDistributedNodes()
 

Example

diff --git a/files/en-us/web/api/htmltableelement/align/index.html b/files/en-us/web/api/htmltableelement/align/index.html index 4576c88c8becc2e..c38060f796ae1c4 100644 --- a/files/en-us/web/api/htmltableelement/align/index.html +++ b/files/en-us/web/api/htmltableelement/align/index.html @@ -18,7 +18,7 @@

Syntax

-
HTMLTableElement.align = alignment;
+
HTMLTableElement.align = alignment;
 var alignment = HTMLTableElement.align;

Parameters

diff --git a/files/en-us/web/api/htmltableelement/bgcolor/index.html b/files/en-us/web/api/htmltableelement/bgcolor/index.html index 105be617e587090..25d4cf94f0310a4 100644 --- a/files/en-us/web/api/htmltableelement/bgcolor/index.html +++ b/files/en-us/web/api/htmltableelement/bgcolor/index.html @@ -27,7 +27,7 @@

Syntax

-
color = table.bgColor
+
color = table.bgColor
 table.bgColor = color

Parameters

diff --git a/files/en-us/web/api/htmltableelement/border/index.html b/files/en-us/web/api/htmltableelement/border/index.html index 2f5a74621b75a63..6af085793520220 100644 --- a/files/en-us/web/api/htmltableelement/border/index.html +++ b/files/en-us/web/api/htmltableelement/border/index.html @@ -16,7 +16,7 @@

Syntax

-
HTMLTableElement.border = border;
+
HTMLTableElement.border = border;
 var border = HTMLTableElement.border;
 
diff --git a/files/en-us/web/api/htmltableelement/caption/index.html b/files/en-us/web/api/htmltableelement/caption/index.html index db7cce01149c447..fbed8e431b78922 100644 --- a/files/en-us/web/api/htmltableelement/caption/index.html +++ b/files/en-us/web/api/htmltableelement/caption/index.html @@ -16,7 +16,7 @@

Syntax

var string = tableElement.caption;
+ class="brush: js">var string = tableElement.caption;

Example

diff --git a/files/en-us/web/api/htmltableelement/cellpadding/index.html b/files/en-us/web/api/htmltableelement/cellpadding/index.html index 6de4538042f2c79..0032249dc1630c2 100644 --- a/files/en-us/web/api/htmltableelement/cellpadding/index.html +++ b/files/en-us/web/api/htmltableelement/cellpadding/index.html @@ -15,7 +15,7 @@

Syntax

-
HTMLTableElement.cellPadding = padding;
+
HTMLTableElement.cellPadding = padding;
 var padding = HTMLTableElement.cellPadding;
    diff --git a/files/en-us/web/api/htmltableelement/cellspacing/index.html b/files/en-us/web/api/htmltableelement/cellspacing/index.html index 51b4771ca3e5163..423be2cfc246b89 100644 --- a/files/en-us/web/api/htmltableelement/cellspacing/index.html +++ b/files/en-us/web/api/htmltableelement/cellspacing/index.html @@ -26,7 +26,7 @@

    Syntax

    -
    HTMLTableElement.cellSpacing = spacing;
    +
    HTMLTableElement.cellSpacing = spacing;
     var spacing = HTMLTableElement.cellSpacing;

    Value

    diff --git a/files/en-us/web/api/htmltableelement/createcaption/index.html b/files/en-us/web/api/htmltableelement/createcaption/index.html index cca18c8ec1fc390..551c4cd75845dd9 100644 --- a/files/en-us/web/api/htmltableelement/createcaption/index.html +++ b/files/en-us/web/api/htmltableelement/createcaption/index.html @@ -26,7 +26,7 @@

    Syntax

    HTMLTableElement = table.createCaption();
    + class="brush: js">HTMLTableElement = table.createCaption();

    Return value

    @@ -38,14 +38,14 @@

    Example

    HTML

    -
    <table>
    +
    <table>
       <tr><td>Cell 1.1</td><td>Cell 1.2</td><td>Cell 1.3</td></tr>
       <tr><td>Cell 2.1</td><td>Cell 2.2</td><td>Cell 2.3</td></tr>
     </table>

    JavaScript

    -
    let table = document.querySelector('table');
    +
    let table = document.querySelector('table');
     let caption = table.createCaption();
     caption.textContent = 'This caption was created by JavaScript!';
    diff --git a/files/en-us/web/api/htmltableelement/createtbody/index.html b/files/en-us/web/api/htmltableelement/createtbody/index.html index 60633663af242cf..04908c9c24093d8 100644 --- a/files/en-us/web/api/htmltableelement/createtbody/index.html +++ b/files/en-us/web/api/htmltableelement/createtbody/index.html @@ -25,7 +25,7 @@

    Syntax

    -
    table.createTBody();
    +
    table.createTBody();

    Return value

    diff --git a/files/en-us/web/api/htmltableelement/createtfoot/index.html b/files/en-us/web/api/htmltableelement/createtfoot/index.html index 20bda65d320345d..01a1881f7bb3cfe 100644 --- a/files/en-us/web/api/htmltableelement/createtfoot/index.html +++ b/files/en-us/web/api/htmltableelement/createtfoot/index.html @@ -25,7 +25,7 @@

    Syntax

    -
    table.createTFoot();
    +
    table.createTFoot();

    Return value

    diff --git a/files/en-us/web/api/htmltableelement/createthead/index.html b/files/en-us/web/api/htmltableelement/createthead/index.html index 93ff26a392b9f5b..417194552df504d 100644 --- a/files/en-us/web/api/htmltableelement/createthead/index.html +++ b/files/en-us/web/api/htmltableelement/createthead/index.html @@ -25,7 +25,7 @@

    Syntax

    -
    table.createTHead();
    +
    table.createTHead();

    Return value

    diff --git a/files/en-us/web/api/htmltableelement/deletecaption/index.html b/files/en-us/web/api/htmltableelement/deletecaption/index.html index 5b01aa89d0a789d..8c47b2a3a3d7a67 100644 --- a/files/en-us/web/api/htmltableelement/deletecaption/index.html +++ b/files/en-us/web/api/htmltableelement/deletecaption/index.html @@ -18,7 +18,7 @@

    Syntax

    -
    HTMLTableElement.deleteCaption()
    +
    HTMLTableElement.deleteCaption()

    Example

    diff --git a/files/en-us/web/api/htmltableelement/deleterow/index.html b/files/en-us/web/api/htmltableelement/deleterow/index.html index bee13058c34e006..e1c5d3ad23ad644 100644 --- a/files/en-us/web/api/htmltableelement/deleterow/index.html +++ b/files/en-us/web/api/htmltableelement/deleterow/index.html @@ -17,7 +17,7 @@

    Syntax

    HTMLTableElement.deleteRow(index)
    + class="brush: js">HTMLTableElement.deleteRow(index)

    Parameters

    diff --git a/files/en-us/web/api/htmltableelement/deletetfoot/index.html b/files/en-us/web/api/htmltableelement/deletetfoot/index.html index 20c30f01455edde..166259d38c44fd9 100644 --- a/files/en-us/web/api/htmltableelement/deletetfoot/index.html +++ b/files/en-us/web/api/htmltableelement/deletetfoot/index.html @@ -16,7 +16,7 @@

    Syntax

    -
    HTMLTableElement.deleteTFoot();
    +
    HTMLTableElement.deleteTFoot();

    Example

    diff --git a/files/en-us/web/api/htmltableelement/deletethead/index.html b/files/en-us/web/api/htmltableelement/deletethead/index.html index 5ce7beb15d77c49..04e4513f54ee260 100644 --- a/files/en-us/web/api/htmltableelement/deletethead/index.html +++ b/files/en-us/web/api/htmltableelement/deletethead/index.html @@ -16,7 +16,7 @@

    Syntax

    -
    HTMLTableElement.deleteTHead();
    +
    HTMLTableElement.deleteTHead();

    Example

    diff --git a/files/en-us/web/api/htmltableelement/frame/index.html b/files/en-us/web/api/htmltableelement/frame/index.html index 731cc0c527346c9..9c4d960e2ffe31f 100644 --- a/files/en-us/web/api/htmltableelement/frame/index.html +++ b/files/en-us/web/api/htmltableelement/frame/index.html @@ -19,7 +19,7 @@

    Syntax

    -
    HTMLTableElement.frame = frameSides;
    +
    HTMLTableElement.frame = frameSides;
     var frameSides = HTMLTableElement.frame;

    Parameters

    diff --git a/files/en-us/web/api/htmltableelement/insertrow/index.html b/files/en-us/web/api/htmltableelement/insertrow/index.html index fcd9e99b77ccb9d..08c20b757e2afe3 100644 --- a/files/en-us/web/api/htmltableelement/insertrow/index.html +++ b/files/en-us/web/api/htmltableelement/insertrow/index.html @@ -33,7 +33,7 @@

    Syntax

    var newRow = HTMLTableElement.insertRow(index);
    + class="brush: js">var newRow = HTMLTableElement.insertRow(index);

    {{domxref("HTMLTableElement")}} is a reference to an HTML {{HtmlElement("table")}} element.

    diff --git a/files/en-us/web/api/htmltableelement/rows/index.html b/files/en-us/web/api/htmltableelement/rows/index.html index 171058d35f4a5ab..237f0b59c0f90c2 100644 --- a/files/en-us/web/api/htmltableelement/rows/index.html +++ b/files/en-us/web/api/htmltableelement/rows/index.html @@ -31,7 +31,7 @@

    Syntax

    HTMLCollectionObject = table.rows;
    + class="brush: js">HTMLCollectionObject = table.rows;

    Value

    diff --git a/files/en-us/web/api/htmltableelement/rules/index.html b/files/en-us/web/api/htmltableelement/rules/index.html index 07aa2c2e374018f..ad657f745714e07 100644 --- a/files/en-us/web/api/htmltableelement/rules/index.html +++ b/files/en-us/web/api/htmltableelement/rules/index.html @@ -21,7 +21,7 @@

    Syntax

    -
    HTMLTableElement.rules = rules;
    +
    HTMLTableElement.rules = rules;
     var rules = HTMLTableElement.rules;

    Parameters

    diff --git a/files/en-us/web/api/htmltableelement/summary/index.html b/files/en-us/web/api/htmltableelement/summary/index.html index 0f6a50331aa698e..1dfad0c24ae1d0e 100644 --- a/files/en-us/web/api/htmltableelement/summary/index.html +++ b/files/en-us/web/api/htmltableelement/summary/index.html @@ -17,7 +17,7 @@

    Syntax

    -
    HTMLTableElement.summary = string;
    +
    HTMLTableElement.summary = string;
     varstring = HTMLTableElement.summary;

    Example

    diff --git a/files/en-us/web/api/htmltableelement/tbodies/index.html b/files/en-us/web/api/htmltableelement/tbodies/index.html index 044c5a277b4fc2c..2ec82b527a464be 100644 --- a/files/en-us/web/api/htmltableelement/tbodies/index.html +++ b/files/en-us/web/api/htmltableelement/tbodies/index.html @@ -33,7 +33,7 @@

    Syntax

    HTMLCollectionObject = table.tBodies
    + class="brush: js">HTMLCollectionObject = table.tBodies

    Example

    diff --git a/files/en-us/web/api/htmltableelement/tfoot/index.html b/files/en-us/web/api/htmltableelement/tfoot/index.html index 770c3722bfb3640..ac7cf68e6011bcb 100644 --- a/files/en-us/web/api/htmltableelement/tfoot/index.html +++ b/files/en-us/web/api/htmltableelement/tfoot/index.html @@ -16,7 +16,7 @@

    Syntax

    -
    HTMLTableSectionElementObject = table.tFoot
    +
    HTMLTableSectionElementObject = table.tFoot
     table.tFoot = HTMLTableSectionElementObject
     
    diff --git a/files/en-us/web/api/htmltableelement/thead/index.html b/files/en-us/web/api/htmltableelement/thead/index.html index 4521ce5a9230336..0725f4950c18ae0 100644 --- a/files/en-us/web/api/htmltableelement/thead/index.html +++ b/files/en-us/web/api/htmltableelement/thead/index.html @@ -16,7 +16,7 @@

    Syntax

    -
    thead_element = table.tHead;
    +
    thead_element = table.tHead;
     table.tHead = thead_element;
     
    diff --git a/files/en-us/web/api/htmltableelement/width/index.html b/files/en-us/web/api/htmltableelement/width/index.html index 69b209045360f38..4dcf5aee9173154 100644 --- a/files/en-us/web/api/htmltableelement/width/index.html +++ b/files/en-us/web/api/htmltableelement/width/index.html @@ -17,7 +17,7 @@

    Syntax

    -
    HTMLTableElement.width = width;
    +
    HTMLTableElement.width = width;
     var width = HTMLTableElement.width;

    Where width is a string representing the width in number of pixels or as a diff --git a/files/en-us/web/api/idbkeyrange/bound/index.html b/files/en-us/web/api/idbkeyrange/bound/index.html index 387973b2d286a5c..c3f490dc5744851 100644 --- a/files/en-us/web/api/idbkeyrange/bound/index.html +++ b/files/en-us/web/api/idbkeyrange/bound/index.html @@ -24,7 +24,7 @@

    Syntax

    -
    var myIDBKeyRange = IDBKeyRange.bound(lower, upper);
    +
    var myIDBKeyRange = IDBKeyRange.bound(lower, upper);
     var myIDBKeyRange = IDBKeyRange.bound(lower, upper, lowerOpen);
     var myIDBKeyRange = IDBKeyRange.bound(lower, upper, lowerOpen, upperOpen);
     
    diff --git a/files/en-us/web/api/idbkeyrange/includes/index.html b/files/en-us/web/api/idbkeyrange/includes/index.html index 41a245b5d749193..7bbb0d77cb6b8b2 100644 --- a/files/en-us/web/api/idbkeyrange/includes/index.html +++ b/files/en-us/web/api/idbkeyrange/includes/index.html @@ -23,7 +23,7 @@

    Syntax

    -
    var isIncluded = myKeyRange.includes(key)
    +
    var isIncluded = myKeyRange.includes(key)

    Parameters

    diff --git a/files/en-us/web/api/idbkeyrange/lower/index.html b/files/en-us/web/api/idbkeyrange/lower/index.html index 9a182c2049bed1e..d7c6d69fd0c368e 100644 --- a/files/en-us/web/api/idbkeyrange/lower/index.html +++ b/files/en-us/web/api/idbkeyrange/lower/index.html @@ -22,7 +22,7 @@

    Syntax

    -
    var lower = myKeyRange.lower
    +
    var lower = myKeyRange.lower

    Value

    diff --git a/files/en-us/web/api/idbkeyrange/lowerbound/index.html b/files/en-us/web/api/idbkeyrange/lowerbound/index.html index 5405a390156b7dc..3eb285482647016 100644 --- a/files/en-us/web/api/idbkeyrange/lowerbound/index.html +++ b/files/en-us/web/api/idbkeyrange/lowerbound/index.html @@ -23,7 +23,7 @@

    Syntax

    -
    var myIDBKeyRange = IDBKeyRange.lowerBound(lower);
    +
    var myIDBKeyRange = IDBKeyRange.lowerBound(lower);
     var myIDBKeyRange = IDBKeyRange.lowerBound(lower, open);
     
    @@ -82,7 +82,7 @@

    Example

    too.)

    -
    function displayData() {
    +
    function displayData() {
       var keyRangeValue = IDBKeyRange.lowerBound("F");
     
       var transaction = db.transaction(['fThings'], 'readonly');
    diff --git a/files/en-us/web/api/idbkeyrange/loweropen/index.html b/files/en-us/web/api/idbkeyrange/loweropen/index.html
    index df809635956198b..66b8e76e6bd7a34 100644
    --- a/files/en-us/web/api/idbkeyrange/loweropen/index.html
    +++ b/files/en-us/web/api/idbkeyrange/loweropen/index.html
    @@ -23,7 +23,7 @@
     
     

    Syntax

    -
    var lowerOpen = myKeyRange.lowerOpen
    +
    var lowerOpen = myKeyRange.lowerOpen

    Value

    diff --git a/files/en-us/web/api/idbkeyrange/only/index.html b/files/en-us/web/api/idbkeyrange/only/index.html index 772b3a2d00631e4..9a97d8b14efff62 100644 --- a/files/en-us/web/api/idbkeyrange/only/index.html +++ b/files/en-us/web/api/idbkeyrange/only/index.html @@ -23,7 +23,7 @@

    Syntax

    var myIDBKeyRange = IDBKeyRange.only(value);
    + class="brush: js">var myIDBKeyRange = IDBKeyRange.only(value);

    Parameters

    diff --git a/files/en-us/web/api/idbkeyrange/upper/index.html b/files/en-us/web/api/idbkeyrange/upper/index.html index 42faf312ca75213..6f33a19a6ce455f 100644 --- a/files/en-us/web/api/idbkeyrange/upper/index.html +++ b/files/en-us/web/api/idbkeyrange/upper/index.html @@ -22,7 +22,7 @@

    Syntax

    -
    var upper = myKeyRange.upper
    +
    var upper = myKeyRange.upper

    Value

    diff --git a/files/en-us/web/api/idbkeyrange/upperbound/index.html b/files/en-us/web/api/idbkeyrange/upperbound/index.html index 9dfd66ae8a4a272..aea4ec5ab86227a 100644 --- a/files/en-us/web/api/idbkeyrange/upperbound/index.html +++ b/files/en-us/web/api/idbkeyrange/upperbound/index.html @@ -24,7 +24,7 @@

    Syntax

    var myIDBKeyRange = IDBKeyRange.upperBound(upper[, open=false])
    + class="brush: js">var myIDBKeyRange = IDBKeyRange.upperBound(upper[, open=false])

    Parameters

    @@ -79,7 +79,7 @@

    Example

    too.)

    -
    function displayData() {
    +
    function displayData() {
       var keyRangeValue = IDBKeyRange.upperBound("F");
     
       var transaction = db.transaction(['fThings'], 'readonly');
    diff --git a/files/en-us/web/api/idbkeyrange/upperopen/index.html b/files/en-us/web/api/idbkeyrange/upperopen/index.html
    index 889f79c155c932f..5cce20809fe4b2d 100644
    --- a/files/en-us/web/api/idbkeyrange/upperopen/index.html
    +++ b/files/en-us/web/api/idbkeyrange/upperopen/index.html
    @@ -23,7 +23,7 @@
     
     

    Syntax

    -
    var upperOpen = myKeyRange.upperOpen
    +
    var upperOpen = myKeyRange.upperOpen

    Value

    diff --git a/files/en-us/web/api/keyboard/getlayoutmap/index.html b/files/en-us/web/api/keyboard/getlayoutmap/index.html index c7c5813cef156bd..042e8193b44ce2d 100644 --- a/files/en-us/web/api/keyboard/getlayoutmap/index.html +++ b/files/en-us/web/api/keyboard/getlayoutmap/index.html @@ -22,7 +22,7 @@

    Syntax

    var promise = Keyboard.getLayoutMap()
    + class="brush: js">var promise = Keyboard.getLayoutMap()

    Parameters

    diff --git a/files/en-us/web/api/keyboard/lock/index.html b/files/en-us/web/api/keyboard/lock/index.html index e78ca23a8c29353..dcccd4b081fa7d3 100644 --- a/files/en-us/web/api/keyboard/lock/index.html +++ b/files/en-us/web/api/keyboard/lock/index.html @@ -21,7 +21,7 @@

    Syntax

    var promise = Keyboard.lock([keyCodes[]])
    + class="brush: js">var promise = Keyboard.lock([keyCodes[]])

    Parameters

    diff --git a/files/en-us/web/api/keyboard/unlock/index.html b/files/en-us/web/api/keyboard/unlock/index.html index e72291616d96821..5f1bead2f9bcbac 100644 --- a/files/en-us/web/api/keyboard/unlock/index.html +++ b/files/en-us/web/api/keyboard/unlock/index.html @@ -18,7 +18,7 @@

    Syntax

    -
    Keyboard.unlock()
    +
    Keyboard.unlock()

    Parameters

    diff --git a/files/en-us/web/api/mediarecorder/audiobitspersecond/index.html b/files/en-us/web/api/mediarecorder/audiobitspersecond/index.html index 6cfc4c71720a09f..8e7899a29dc8e07 100644 --- a/files/en-us/web/api/mediarecorder/audiobitspersecond/index.html +++ b/files/en-us/web/api/mediarecorder/audiobitspersecond/index.html @@ -19,7 +19,7 @@

    Syntax

    var audioBitsPerSecond = MediaRecorder.audioBitsPerSecond
    + class="brush: js">var audioBitsPerSecond = MediaRecorder.audioBitsPerSecond

    Value

    diff --git a/files/en-us/web/api/mediarecorder/ignoremutedmedia/index.html b/files/en-us/web/api/mediarecorder/ignoremutedmedia/index.html index 781bf2078195c22..23c03406dec0a03 100644 --- a/files/en-us/web/api/mediarecorder/ignoremutedmedia/index.html +++ b/files/en-us/web/api/mediarecorder/ignoremutedmedia/index.html @@ -20,7 +20,7 @@

    Syntax

    -
    var boolean = MediaRecorder.ignoreMutedMedia
    +
    var boolean = MediaRecorder.ignoreMutedMedia
     MediaRecorder.ignoreMutedMedia = boolean

    Value

    diff --git a/files/en-us/web/api/mediarecorder/istypesupported/index.html b/files/en-us/web/api/mediarecorder/istypesupported/index.html index ecf83d73eb0c0ea..52753fcf346137f 100644 --- a/files/en-us/web/api/mediarecorder/istypesupported/index.html +++ b/files/en-us/web/api/mediarecorder/istypesupported/index.html @@ -23,7 +23,7 @@

    Syntax

    var canRecord = MediaRecorder.isTypeSupported(mimeType)
    + class="brush: js">var canRecord = MediaRecorder.isTypeSupported(mimeType)

    Parameters

    diff --git a/files/en-us/web/api/mediarecorder/mediarecorder/index.html b/files/en-us/web/api/mediarecorder/mediarecorder/index.html index 88ae1524937245f..af7693f72664fac 100644 --- a/files/en-us/web/api/mediarecorder/mediarecorder/index.html +++ b/files/en-us/web/api/mediarecorder/mediarecorder/index.html @@ -25,7 +25,7 @@

    Syntax

    var mediaRecorder = new MediaRecorder(stream[, options]);
    + class="brush: js">var mediaRecorder = new MediaRecorder(stream[, options]);

    Parameters

    diff --git a/files/en-us/web/api/mediarecorder/mimetype/index.html b/files/en-us/web/api/mediarecorder/mimetype/index.html index c3351b359a00719..4fb4d6004c60d69 100644 --- a/files/en-us/web/api/mediarecorder/mimetype/index.html +++ b/files/en-us/web/api/mediarecorder/mimetype/index.html @@ -36,7 +36,7 @@

    Syntax

    var mimeType = mediaRecorder.mimeType
    + class="brush: js">var mimeType = mediaRecorder.mimeType

    Value

    diff --git a/files/en-us/web/api/mediarecorder/ondataavailable/index.html b/files/en-us/web/api/mediarecorder/ondataavailable/index.html index 9d976b002004422..166b45da6f8539b 100644 --- a/files/en-us/web/api/mediarecorder/ondataavailable/index.html +++ b/files/en-us/web/api/mediarecorder/ondataavailable/index.html @@ -54,7 +54,7 @@

    Syntax

    -
    MediaRecorder.ondataavailable = function(event) { ... }
    +
    MediaRecorder.ondataavailable = function(event) { ... }
     MediaRecorder.addEventListener('dataavailable', function(event) { ... })
     
    diff --git a/files/en-us/web/api/mediarecorder/onerror/index.html b/files/en-us/web/api/mediarecorder/onerror/index.html index ef65f6a37388d9e..67eec86445e9fc4 100644 --- a/files/en-us/web/api/mediarecorder/onerror/index.html +++ b/files/en-us/web/api/mediarecorder/onerror/index.html @@ -25,7 +25,7 @@

    Syntax

    -
    MediaRecorder.onerror = errorHandlerFunction;
    +
    MediaRecorder.onerror = errorHandlerFunction;
     

    Value

    @@ -76,7 +76,7 @@

    Example

    exceptions are thrown during the setup process.

    -
    function recordStream(stream) {
    +  
    function recordStream(stream) {
       let recorder = null;
       let bufferList = [];
     
    diff --git a/files/en-us/web/api/mediarecorder/onpause/index.html b/files/en-us/web/api/mediarecorder/onpause/index.html
    index 3aab1f6b4f20c5e..d45406214914591 100644
    --- a/files/en-us/web/api/mediarecorder/onpause/index.html
    +++ b/files/en-us/web/api/mediarecorder/onpause/index.html
    @@ -24,7 +24,7 @@
     
     

    Syntax

    -
    MediaRecorder.onpause = function(event) { ... }
    +
    MediaRecorder.onpause = function(event) { ... }
     MediaRecorder.addEventListener('pause', function(event) { ... })
     
    diff --git a/files/en-us/web/api/mediarecorder/onresume/index.html b/files/en-us/web/api/mediarecorder/onresume/index.html index 8fc850d58826702..b18763af277dd95 100644 --- a/files/en-us/web/api/mediarecorder/onresume/index.html +++ b/files/en-us/web/api/mediarecorder/onresume/index.html @@ -24,7 +24,7 @@

    Syntax

    -
    MediaRecorder.onresume = function(event) { ... }
    +
    MediaRecorder.onresume = function(event) { ... }
     MediaRecorder.addEventListener('resume', function(event) { ... })
     
    diff --git a/files/en-us/web/api/mediarecorder/onstart/index.html b/files/en-us/web/api/mediarecorder/onstart/index.html index 9d974bf75c7d2c9..16b8f75acb2dd2f 100644 --- a/files/en-us/web/api/mediarecorder/onstart/index.html +++ b/files/en-us/web/api/mediarecorder/onstart/index.html @@ -26,7 +26,7 @@

    Syntax

    -
    MediaRecorder.onstart = function(event) { ... }
    +
    MediaRecorder.onstart = function(event) { ... }
     MediaRecorder.addEventListener('start', function(event) { ... })

    Example

    diff --git a/files/en-us/web/api/mediarecorder/onstop/index.html b/files/en-us/web/api/mediarecorder/onstop/index.html index f8929879aaae34a..2ac69f4d3c2fdd7 100644 --- a/files/en-us/web/api/mediarecorder/onstop/index.html +++ b/files/en-us/web/api/mediarecorder/onstop/index.html @@ -28,7 +28,7 @@

    Syntax

    -
    MediaRecorder.onstop = function(event) { ... }
    +
    MediaRecorder.onstop = function(event) { ... }
     MediaRecorder.addEventListener('stop', function(event) { ... })

    Example

    diff --git a/files/en-us/web/api/mediarecorder/onwarning/index.html b/files/en-us/web/api/mediarecorder/onwarning/index.html index 3a7d74189793f52..c9df83ece80a049 100644 --- a/files/en-us/web/api/mediarecorder/onwarning/index.html +++ b/files/en-us/web/api/mediarecorder/onwarning/index.html @@ -26,7 +26,7 @@

    Syntax

    mediaRecorder.onwarning = function(event) { ... }
    +  class="brush: js">mediaRecorder.onwarning = function(event) { ... }
     mediaRecorder.addEventListener('warning', function(event) { ... })

    Example

    diff --git a/files/en-us/web/api/mediarecorder/pause/index.html b/files/en-us/web/api/mediarecorder/pause/index.html index e24767a86f802c5..cf2189d47db40a2 100644 --- a/files/en-us/web/api/mediarecorder/pause/index.html +++ b/files/en-us/web/api/mediarecorder/pause/index.html @@ -31,7 +31,7 @@

    Syntax

    -
    MediaRecorder.pause()
    +
    MediaRecorder.pause()

    Return value

    diff --git a/files/en-us/web/api/mediarecorder/requestdata/index.html b/files/en-us/web/api/mediarecorder/requestdata/index.html index 68ff75907070452..00dcad0ba16874c 100644 --- a/files/en-us/web/api/mediarecorder/requestdata/index.html +++ b/files/en-us/web/api/mediarecorder/requestdata/index.html @@ -37,7 +37,7 @@

    Syntax

    -
    MediaRecorder.requestData()
    +
    MediaRecorder.requestData()

    Errors

    diff --git a/files/en-us/web/api/mediarecorder/resume/index.html b/files/en-us/web/api/mediarecorder/resume/index.html index 5857b26b2504b4f..4589246d848063e 100644 --- a/files/en-us/web/api/mediarecorder/resume/index.html +++ b/files/en-us/web/api/mediarecorder/resume/index.html @@ -32,7 +32,7 @@

    Syntax

    MediaRecorder.resume()
    + class="brush: js">MediaRecorder.resume()

    Errors

    diff --git a/files/en-us/web/api/mediarecorder/start/index.html b/files/en-us/web/api/mediarecorder/start/index.html index 233fef95312b1ba..e12d7d6e9145c67 100644 --- a/files/en-us/web/api/mediarecorder/start/index.html +++ b/files/en-us/web/api/mediarecorder/start/index.html @@ -51,7 +51,7 @@

    Syntax

    mediaRecorder.start(timeslice)
    + class="brush: js">mediaRecorder.start(timeslice)

    Parameters

    diff --git a/files/en-us/web/api/mediarecorder/state/index.html b/files/en-us/web/api/mediarecorder/state/index.html index 1eeb462f24843a4..f4f02375153aff6 100644 --- a/files/en-us/web/api/mediarecorder/state/index.html +++ b/files/en-us/web/api/mediarecorder/state/index.html @@ -16,7 +16,7 @@

    Syntax

    -
    var state = MediaRecorder.state
    +
    var state = MediaRecorder.state

    Values

    diff --git a/files/en-us/web/api/mediarecorder/stop/index.html b/files/en-us/web/api/mediarecorder/stop/index.html index 4daa214faeee9b2..2eb933d70fad378 100644 --- a/files/en-us/web/api/mediarecorder/stop/index.html +++ b/files/en-us/web/api/mediarecorder/stop/index.html @@ -34,7 +34,7 @@

    Syntax

    MediaRecorder.stop()
    + class="brush: js">MediaRecorder.stop()

    Errors

    diff --git a/files/en-us/web/api/mediarecorder/stream/index.html b/files/en-us/web/api/mediarecorder/stream/index.html index cd5c51a9793ab19..0c5415e3b09553c 100644 --- a/files/en-us/web/api/mediarecorder/stream/index.html +++ b/files/en-us/web/api/mediarecorder/stream/index.html @@ -18,7 +18,7 @@

    Syntax

    var stream = MediaRecorder.stream
    + class="brush: js">var stream = MediaRecorder.stream

    Values

    diff --git a/files/en-us/web/api/mediarecorder/videobitspersecond/index.html b/files/en-us/web/api/mediarecorder/videobitspersecond/index.html index 60d2df972784ec7..535afaee8ea01f6 100644 --- a/files/en-us/web/api/mediarecorder/videobitspersecond/index.html +++ b/files/en-us/web/api/mediarecorder/videobitspersecond/index.html @@ -12,7 +12,7 @@

    Syntax

    var videoBitsPerSecond = MediaRecorder.videoBitsPerSecond
    + class="brush: js">var videoBitsPerSecond = MediaRecorder.videoBitsPerSecond

    Value

    diff --git a/files/en-us/web/api/mediasettingsrange/max/index.html b/files/en-us/web/api/mediasettingsrange/max/index.html index 5cb90eb2af791c6..cddfae79a9621fe 100644 --- a/files/en-us/web/api/mediasettingsrange/max/index.html +++ b/files/en-us/web/api/mediasettingsrange/max/index.html @@ -20,7 +20,7 @@

    Syntax

    var max = mediaSettingsRange.max
    + class="brush: js">var max = mediaSettingsRange.max

    Value

    diff --git a/files/en-us/web/api/mediasettingsrange/min/index.html b/files/en-us/web/api/mediasettingsrange/min/index.html index 5a9643e1adf3843..eb1d9bc0f898d6d 100644 --- a/files/en-us/web/api/mediasettingsrange/min/index.html +++ b/files/en-us/web/api/mediasettingsrange/min/index.html @@ -20,7 +20,7 @@

    Syntax

    var min = mediaSettingsRange.min
    + class="brush: js">var min = mediaSettingsRange.min

    Value

    diff --git a/files/en-us/web/api/mediasettingsrange/step/index.html b/files/en-us/web/api/mediasettingsrange/step/index.html index d2ccb318dafdcde..d67f608faa2da6c 100644 --- a/files/en-us/web/api/mediasettingsrange/step/index.html +++ b/files/en-us/web/api/mediasettingsrange/step/index.html @@ -20,7 +20,7 @@

    Syntax

    var step = mediaSettingsRange.step
    + class="brush: js">var step = mediaSettingsRange.step

    Value

    diff --git a/files/en-us/web/api/mouseevent/altkey/index.html b/files/en-us/web/api/mouseevent/altkey/index.html index 2076740e31b5004..0a6cd99e1e8d6d9 100644 --- a/files/en-us/web/api/mouseevent/altkey/index.html +++ b/files/en-us/web/api/mouseevent/altkey/index.html @@ -27,7 +27,7 @@

    Syntax

    -
    var altKeyPressed = instanceOfMouseEvent.altKey
    +
    var altKeyPressed = instanceOfMouseEvent.altKey
     

    Return value

    diff --git a/files/en-us/web/api/mouseevent/button/index.html b/files/en-us/web/api/mouseevent/button/index.html index e017edf38eedc03..909036d1d99ad8d 100644 --- a/files/en-us/web/api/mouseevent/button/index.html +++ b/files/en-us/web/api/mouseevent/button/index.html @@ -33,7 +33,7 @@

    Syntax

    -
    var buttonPressed = instanceOfMouseEvent.button
    +
    var buttonPressed = instanceOfMouseEvent.button
     

    Return value

    diff --git a/files/en-us/web/api/mouseevent/buttons/index.html b/files/en-us/web/api/mouseevent/buttons/index.html index 64db2fd0f147dd9..2ce1e557e1ca702 100644 --- a/files/en-us/web/api/mouseevent/buttons/index.html +++ b/files/en-us/web/api/mouseevent/buttons/index.html @@ -33,7 +33,7 @@

    Syntax

    -
    var buttonsPressed = instanceOfMouseEvent.buttons
    +
    var buttonsPressed = instanceOfMouseEvent.buttons
     

    Return value

    @@ -59,12 +59,12 @@

    Example

    HTML

    -
    <p>Click anywhere with one or more mouse buttons.</p>
    +
    <p>Click anywhere with one or more mouse buttons.</p>
     <pre id="log">buttons: </pre>

    JavaScript

    -
    let log = document.createTextNode('?');   // let log = new Text('?');
    +
    let log = document.createTextNode('?');   // let log = new Text('?');
     
     function logButtons(e) {
       log.data = `${e.buttons} (${e.type})`;  // log.nodeValue= `${e.buttons} (${e.type})`;
    diff --git a/files/en-us/web/api/mouseevent/clientx/index.html b/files/en-us/web/api/mouseevent/clientx/index.html
    index fcbc663526f849d..e3dae7e822edfa3 100644
    --- a/files/en-us/web/api/mouseevent/clientx/index.html
    +++ b/files/en-us/web/api/mouseevent/clientx/index.html
    @@ -24,7 +24,7 @@
     
     

    Syntax

    -
    var x = instanceOfMouseEvent.clientX
    +
    var x = instanceOfMouseEvent.clientX
     

    Return value

    @@ -40,12 +40,12 @@

    Example

    HTML

    -
    <p>Move your mouse to see its position.</p>
    +
    <p>Move your mouse to see its position.</p>
     <p id="screen-log"></p>

    JavaScript

    -
    let screenLog = document.querySelector('#screen-log');
    +
    let screenLog = document.querySelector('#screen-log');
     document.addEventListener('mousemove', logKey);
     
     function logKey(e) {
    diff --git a/files/en-us/web/api/mouseevent/clienty/index.html b/files/en-us/web/api/mouseevent/clienty/index.html
    index 257fcf19c684a8b..6e81e5b14e323f5 100644
    --- a/files/en-us/web/api/mouseevent/clienty/index.html
    +++ b/files/en-us/web/api/mouseevent/clienty/index.html
    @@ -23,7 +23,7 @@
     
     

    Syntax

    -
    var y = instanceOfMouseEvent.clientY
    +
    var y = instanceOfMouseEvent.clientY
     

    Return value

    @@ -39,12 +39,12 @@

    Example

    HTML

    -
    <p>Move your mouse to see its position.</p>
    +
    <p>Move your mouse to see its position.</p>
     <p id="screen-log"></p>

    JavaScript

    -
    let screenLog = document.querySelector('#screen-log');
    +
    let screenLog = document.querySelector('#screen-log');
     document.addEventListener('mousemove', logKey);
     
     function logKey(e) {
    diff --git a/files/en-us/web/api/mouseevent/ctrlkey/index.html b/files/en-us/web/api/mouseevent/ctrlkey/index.html
    index 77e658485609040..a6d4b041eb8b6ca 100644
    --- a/files/en-us/web/api/mouseevent/ctrlkey/index.html
    +++ b/files/en-us/web/api/mouseevent/ctrlkey/index.html
    @@ -23,7 +23,7 @@
     
     

    Syntax

    -
    var ctrlKeyPressed = instanceOfMouseEvent.ctrlKey
    +
    var ctrlKeyPressed = instanceOfMouseEvent.ctrlKey
     

    Return value

    diff --git a/files/en-us/web/api/mouseevent/getmodifierstate/index.html b/files/en-us/web/api/mouseevent/getmodifierstate/index.html index 6dc200ce0746083..c7282ea50a75b44 100644 --- a/files/en-us/web/api/mouseevent/getmodifierstate/index.html +++ b/files/en-us/web/api/mouseevent/getmodifierstate/index.html @@ -23,7 +23,7 @@

    Syntax

    var active = event.getModifierState(keyArg);
    + class="brush: js">var active = event.getModifierState(keyArg);

    Returns 

    diff --git a/files/en-us/web/api/mouseevent/index.html b/files/en-us/web/api/mouseevent/index.html index 653ba4e1388fb0b..cd54d75761ec0a7 100644 --- a/files/en-us/web/api/mouseevent/index.html +++ b/files/en-us/web/api/mouseevent/index.html @@ -111,12 +111,12 @@

    Example

    HTML

    -
    <p><label><input type="checkbox" id="checkbox"> Checked</label>
    +
    <p><label><input type="checkbox" id="checkbox"> Checked</label>
     <p><button id="button">Click me</button>

    JavaScript

    -
    function simulateClick() {
    +
    function simulateClick() {
       var evt = new MouseEvent("click", {
         bubbles: true,
         cancelable: true,
    diff --git a/files/en-us/web/api/mouseevent/initmouseevent/index.html b/files/en-us/web/api/mouseevent/initmouseevent/index.html
    index 33a1a943d0dd6d9..ac70be51ac14347 100644
    --- a/files/en-us/web/api/mouseevent/initmouseevent/index.html
    +++ b/files/en-us/web/api/mouseevent/initmouseevent/index.html
    @@ -32,7 +32,7 @@
     
     

    Syntax

    -
    event.initMouseEvent(type, canBubble, cancelable, view,
    +
    event.initMouseEvent(type, canBubble, cancelable, view,
                          detail, screenX, screenY, clientX, clientY,
                          ctrlKey, altKey, shiftKey, metaKey,
                          button, relatedTarget);
    diff --git a/files/en-us/web/api/mouseevent/metakey/index.html b/files/en-us/web/api/mouseevent/metakey/index.html index cf24bc3f8405d1a..30fdd8fcce40fd2 100644 --- a/files/en-us/web/api/mouseevent/metakey/index.html +++ b/files/en-us/web/api/mouseevent/metakey/index.html @@ -27,7 +27,7 @@

    Syntax

    -
    var metaKeyPressed = instanceOfMouseEvent.metaKey
    +
    var metaKeyPressed = instanceOfMouseEvent.metaKey
     

    Return value

    diff --git a/files/en-us/web/api/mouseevent/mouseevent/index.html b/files/en-us/web/api/mouseevent/mouseevent/index.html index d81561d047e7306..e7039e5e8c952fd 100644 --- a/files/en-us/web/api/mouseevent/mouseevent/index.html +++ b/files/en-us/web/api/mouseevent/mouseevent/index.html @@ -17,7 +17,7 @@

    Syntax

     event = new MouseEvent(typeArg, mouseEventInit);
    + class="brush: js"> event = new MouseEvent(typeArg, mouseEventInit);

    Values

    diff --git a/files/en-us/web/api/mouseevent/movementx/index.html b/files/en-us/web/api/mouseevent/movementx/index.html index b366561080b07c5..339080fde3d3a13 100644 --- a/files/en-us/web/api/mouseevent/movementx/index.html +++ b/files/en-us/web/api/mouseevent/movementx/index.html @@ -23,7 +23,7 @@

    Syntax

    -
    var xShift = instanceOfMouseEvent.movementX;
    +
    var xShift = instanceOfMouseEvent.movementX;
     

    Return value

    diff --git a/files/en-us/web/api/mouseevent/movementy/index.html b/files/en-us/web/api/mouseevent/movementy/index.html index ad6276f61c9e2cd..99fc5b290649cf9 100644 --- a/files/en-us/web/api/mouseevent/movementy/index.html +++ b/files/en-us/web/api/mouseevent/movementy/index.html @@ -23,7 +23,7 @@

    Syntax

    -
    var yShift = instanceOfMouseEvent.movementY;
    +
    var yShift = instanceOfMouseEvent.movementY;
     

    Return value

    diff --git a/files/en-us/web/api/mouseevent/mozinputsource/index.html b/files/en-us/web/api/mouseevent/mozinputsource/index.html index 8046f036944396b..ee96a81d0624eab 100644 --- a/files/en-us/web/api/mouseevent/mozinputsource/index.html +++ b/files/en-us/web/api/mouseevent/mozinputsource/index.html @@ -19,7 +19,7 @@

    Syntax

    var source = instanceOfMouseEvent.mozInputSource;
    + class="brush: js">var source = instanceOfMouseEvent.mozInputSource;

    Return value

    diff --git a/files/en-us/web/api/mouseevent/offsetx/index.html b/files/en-us/web/api/mouseevent/offsetx/index.html index 1ddb05dc9d847f3..3f65383361d04d2 100644 --- a/files/en-us/web/api/mouseevent/offsetx/index.html +++ b/files/en-us/web/api/mouseevent/offsetx/index.html @@ -17,7 +17,7 @@

    Syntax

    -
    var xOffset = instanceOfMouseEvent.offsetX;
    +
    var xOffset = instanceOfMouseEvent.offsetX;
     

    Return value

    diff --git a/files/en-us/web/api/mouseevent/offsety/index.html b/files/en-us/web/api/mouseevent/offsety/index.html index 9e51ef39b81eb66..a91bbec1fb54355 100644 --- a/files/en-us/web/api/mouseevent/offsety/index.html +++ b/files/en-us/web/api/mouseevent/offsety/index.html @@ -17,7 +17,7 @@

    Syntax

    -
    var yOffset = instanceOfMouseEvent.offsetY;
    +
    var yOffset = instanceOfMouseEvent.offsetY;
     

    Return value

    diff --git a/files/en-us/web/api/mouseevent/pagex/index.html b/files/en-us/web/api/mouseevent/pagex/index.html index bcc00398670db52..584638236bf332d 100644 --- a/files/en-us/web/api/mouseevent/pagex/index.html +++ b/files/en-us/web/api/mouseevent/pagex/index.html @@ -38,7 +38,7 @@

    Syntax

    var pageX = MouseEvent.pageX;
    + class="brush: js">var pageX = MouseEvent.pageX;

    Value

    diff --git a/files/en-us/web/api/mouseevent/pagey/index.html b/files/en-us/web/api/mouseevent/pagey/index.html index 10cb0eaeecd9776..d62c9bc8119d595 100644 --- a/files/en-us/web/api/mouseevent/pagey/index.html +++ b/files/en-us/web/api/mouseevent/pagey/index.html @@ -17,7 +17,7 @@

    Syntax

    -
    var pos = event.pageY;
    +
    var pos = event.pageY;

    Originally, this property was defined as a long integer. The CSSOM View Module redefined it as a double float. See the Browser compatibility diff --git a/files/en-us/web/api/mouseevent/region/index.html b/files/en-us/web/api/mouseevent/region/index.html index 57d01fef2a2879e..84a347800ec5055 100644 --- a/files/en-us/web/api/mouseevent/region/index.html +++ b/files/en-us/web/api/mouseevent/region/index.html @@ -19,7 +19,7 @@

    Syntax

    -
    var hitRegion = instanceOfMouseEvent.region
    +
    var hitRegion = instanceOfMouseEvent.region
     

    Return value

    diff --git a/files/en-us/web/api/mouseevent/relatedtarget/index.html b/files/en-us/web/api/mouseevent/relatedtarget/index.html index 4ad9859de4efff6..df36bb6c8bf99b7 100644 --- a/files/en-us/web/api/mouseevent/relatedtarget/index.html +++ b/files/en-us/web/api/mouseevent/relatedtarget/index.html @@ -62,7 +62,7 @@

    Syntax

    -
    var target = instanceOfMouseEvent.relatedTarget
    +
    var target = instanceOfMouseEvent.relatedTarget
     

    Return value

    diff --git a/files/en-us/web/api/mouseevent/screenx/index.html b/files/en-us/web/api/mouseevent/screenx/index.html index c92f6e6ef98c2f7..305f609043b3c81 100644 --- a/files/en-us/web/api/mouseevent/screenx/index.html +++ b/files/en-us/web/api/mouseevent/screenx/index.html @@ -18,7 +18,7 @@

    Syntax

    -
    var x = instanceOfMouseEvent.screenX
    +
    var x = instanceOfMouseEvent.screenX
     

    Return value

    diff --git a/files/en-us/web/api/mouseevent/screeny/index.html b/files/en-us/web/api/mouseevent/screeny/index.html index c122adf11768aef..9c8ed4d4181bce1 100644 --- a/files/en-us/web/api/mouseevent/screeny/index.html +++ b/files/en-us/web/api/mouseevent/screeny/index.html @@ -17,7 +17,7 @@

    Syntax

    -
    var y = instanceOfMouseEvent.screenY
    +
    var y = instanceOfMouseEvent.screenY
     

    Return value

    diff --git a/files/en-us/web/api/mouseevent/shiftkey/index.html b/files/en-us/web/api/mouseevent/shiftkey/index.html index 534ab5d350e6f8d..f1e66b592bac7be 100644 --- a/files/en-us/web/api/mouseevent/shiftkey/index.html +++ b/files/en-us/web/api/mouseevent/shiftkey/index.html @@ -18,7 +18,7 @@

    Syntax

    -
    var shiftKeyPressed = instanceOfMouseEvent.shiftKey
    +
    var shiftKeyPressed = instanceOfMouseEvent.shiftKey
     

    Return value

    diff --git a/files/en-us/web/api/mouseevent/which/index.html b/files/en-us/web/api/mouseevent/which/index.html index dd86c3dadd4000a..52ecab19dd1c68c 100644 --- a/files/en-us/web/api/mouseevent/which/index.html +++ b/files/en-us/web/api/mouseevent/which/index.html @@ -21,7 +21,7 @@

    Syntax

    -
    var buttonPressed = instanceOfMouseEvent.which
    +
    var buttonPressed = instanceOfMouseEvent.which
     

    Return value

    diff --git a/files/en-us/web/api/networkinformation/downlink/index.html b/files/en-us/web/api/networkinformation/downlink/index.html index 1a887a6c90d1f43..3581ab58f5a0b6f 100644 --- a/files/en-us/web/api/networkinformation/downlink/index.html +++ b/files/en-us/web/api/networkinformation/downlink/index.html @@ -28,7 +28,7 @@

    Syntax

    var downLink = NetworkInformation.downlink
    + class="brush: js">var downLink = NetworkInformation.downlink

    Value

    diff --git a/files/en-us/web/api/networkinformation/downlinkmax/index.html b/files/en-us/web/api/networkinformation/downlinkmax/index.html index 7b5f8db25de5aef..3ab4c843986ccb9 100644 --- a/files/en-us/web/api/networkinformation/downlinkmax/index.html +++ b/files/en-us/web/api/networkinformation/downlinkmax/index.html @@ -21,7 +21,7 @@

    Syntax

    var max = NetworkInformation.downlinkMax
    + class="brush: js">var max = NetworkInformation.downlinkMax

    Return value

    diff --git a/files/en-us/web/api/networkinformation/effectivetype/index.html b/files/en-us/web/api/networkinformation/effectivetype/index.html index 70c37fe2c25e531..db1a7bef1528c0c 100644 --- a/files/en-us/web/api/networkinformation/effectivetype/index.html +++ b/files/en-us/web/api/networkinformation/effectivetype/index.html @@ -19,7 +19,7 @@

    Syntax

    var effectiveType = NetworkInformation.effectiveType
    + class="brush: js">var effectiveType = NetworkInformation.effectiveType

    Value

    diff --git a/files/en-us/web/api/networkinformation/onchange/index.html b/files/en-us/web/api/networkinformation/onchange/index.html index e4256979d109cf4..5f1cca8bbdc3ad2 100644 --- a/files/en-us/web/api/networkinformation/onchange/index.html +++ b/files/en-us/web/api/networkinformation/onchange/index.html @@ -18,7 +18,7 @@

    Syntax

    -
    netInfo.onchange = function() { ... }
    +
    netInfo.onchange = function() { ... }
     

    Examples

    diff --git a/files/en-us/web/api/networkinformation/rtt/index.html b/files/en-us/web/api/networkinformation/rtt/index.html index 07e684c0ce72774..aaa8e5766cca145 100644 --- a/files/en-us/web/api/networkinformation/rtt/index.html +++ b/files/en-us/web/api/networkinformation/rtt/index.html @@ -24,7 +24,7 @@

    Syntax

    -
    rtt = NetworkInformation.rtt
    +
    rtt = NetworkInformation.rtt

    Return value

    diff --git a/files/en-us/web/api/networkinformation/savedata/index.html b/files/en-us/web/api/networkinformation/savedata/index.html index e297e7a05929369..683a7a15b421168 100644 --- a/files/en-us/web/api/networkinformation/savedata/index.html +++ b/files/en-us/web/api/networkinformation/savedata/index.html @@ -20,7 +20,7 @@

    Syntax

    var saveData = NetworkInformation.saveData;
    + class="brush: js">var saveData = NetworkInformation.saveData;

    Value

    diff --git a/files/en-us/web/api/networkinformation/type/index.html b/files/en-us/web/api/networkinformation/type/index.html index 199c816e1534905..c7ef294796a5c62 100644 --- a/files/en-us/web/api/networkinformation/type/index.html +++ b/files/en-us/web/api/networkinformation/type/index.html @@ -19,7 +19,7 @@

    Syntax

    -
    var type = netInfo.type
    +
    var type = netInfo.type

    Return value

    diff --git a/files/en-us/web/api/nodeiterator/detach/index.html b/files/en-us/web/api/nodeiterator/detach/index.html index eb2c5fe318fdc49..4fdef30bfa664af 100644 --- a/files/en-us/web/api/nodeiterator/detach/index.html +++ b/files/en-us/web/api/nodeiterator/detach/index.html @@ -21,7 +21,7 @@

    Syntax

    -
    nodeIterator.detach();
    +
    nodeIterator.detach();
     

    Example

    diff --git a/files/en-us/web/api/nodeiterator/expandentityreferences/index.html b/files/en-us/web/api/nodeiterator/expandentityreferences/index.html index da1cef7638c733e..ac1b7070a4c31f7 100644 --- a/files/en-us/web/api/nodeiterator/expandentityreferences/index.html +++ b/files/en-us/web/api/nodeiterator/expandentityreferences/index.html @@ -20,7 +20,7 @@

    Syntax

    -
    expand = nodeIterator.expandEntityReferences;
    +
    expand = nodeIterator.expandEntityReferences;
     

    Example

    diff --git a/files/en-us/web/api/nodeiterator/filter/index.html b/files/en-us/web/api/nodeiterator/filter/index.html index 67d5b8864436829..222d7ddf9d2eec2 100644 --- a/files/en-us/web/api/nodeiterator/filter/index.html +++ b/files/en-us/web/api/nodeiterator/filter/index.html @@ -22,7 +22,7 @@

    Syntax

    -
    nodeFilter = nodeIterator.filter;
    +
    nodeFilter = nodeIterator.filter;
     

    Example

    diff --git a/files/en-us/web/api/nodeiterator/index.html b/files/en-us/web/api/nodeiterator/index.html index be3b2a966eab616..8d0ffca906e75ff 100644 --- a/files/en-us/web/api/nodeiterator/index.html +++ b/files/en-us/web/api/nodeiterator/index.html @@ -17,7 +17,7 @@

    Syntax

    {{domxref("Document.createNodeIterator()")}} method, as follows:

    const nodeIterator = document.createNodeIterator(root, whatToShow, filter);
    + class="brush: js">const nodeIterator = document.createNodeIterator(root, whatToShow, filter);

    Properties

    diff --git a/files/en-us/web/api/nodeiterator/nextnode/index.html b/files/en-us/web/api/nodeiterator/nextnode/index.html index 5d2ac10312d7a2b..bedcfd46229a810 100644 --- a/files/en-us/web/api/nodeiterator/nextnode/index.html +++ b/files/en-us/web/api/nodeiterator/nextnode/index.html @@ -23,7 +23,7 @@

    Syntax

    -
    node = nodeIterator.nextNode();
    +
    node = nodeIterator.nextNode();
     

    Example

    diff --git a/files/en-us/web/api/nodeiterator/pointerbeforereferencenode/index.html b/files/en-us/web/api/nodeiterator/pointerbeforereferencenode/index.html index 73af7cb92c7166a..ec1ecd210cfbd94 100644 --- a/files/en-us/web/api/nodeiterator/pointerbeforereferencenode/index.html +++ b/files/en-us/web/api/nodeiterator/pointerbeforereferencenode/index.html @@ -19,7 +19,7 @@

    Syntax

    -
    flag = nodeIterator.pointerBeforeReferenceNode;
    +
    flag = nodeIterator.pointerBeforeReferenceNode;
     

    Example

    diff --git a/files/en-us/web/api/nodeiterator/previousnode/index.html b/files/en-us/web/api/nodeiterator/previousnode/index.html index 12b6ea93bb8223b..f32070b7f2d9632 100644 --- a/files/en-us/web/api/nodeiterator/previousnode/index.html +++ b/files/en-us/web/api/nodeiterator/previousnode/index.html @@ -23,7 +23,7 @@

    Syntax

    -
    node = nodeIterator.previousNode();
    +
    node = nodeIterator.previousNode();
     

    Example

    diff --git a/files/en-us/web/api/nodeiterator/referencenode/index.html b/files/en-us/web/api/nodeiterator/referencenode/index.html index 0f736efc8f29d8e..02dfa4faa2993df 100644 --- a/files/en-us/web/api/nodeiterator/referencenode/index.html +++ b/files/en-us/web/api/nodeiterator/referencenode/index.html @@ -17,7 +17,7 @@

    Syntax

    -
    node = nodeIterator.referenceNode;
    +
    node = nodeIterator.referenceNode;
     

    Example

    diff --git a/files/en-us/web/api/nodeiterator/root/index.html b/files/en-us/web/api/nodeiterator/root/index.html index ee87250844e2541..df5e88821c0427f 100644 --- a/files/en-us/web/api/nodeiterator/root/index.html +++ b/files/en-us/web/api/nodeiterator/root/index.html @@ -15,7 +15,7 @@

    Syntax

    -
    root = nodeIterator.root;
    +
    root = nodeIterator.root;
     

    Example

    diff --git a/files/en-us/web/api/nodeiterator/whattoshow/index.html b/files/en-us/web/api/nodeiterator/whattoshow/index.html index dc20be0ae8c439c..e91ac0ddb8131fc 100644 --- a/files/en-us/web/api/nodeiterator/whattoshow/index.html +++ b/files/en-us/web/api/nodeiterator/whattoshow/index.html @@ -15,7 +15,7 @@

    Syntax

    -
    var nodeTypes = nodeIterator.whatToShow;
    +
    var nodeTypes = nodeIterator.whatToShow;
     

    The values that can be combined to form the bitmask are:

    diff --git a/files/en-us/web/api/ovr_multiview2/framebuffertexturemultiviewovr/index.html b/files/en-us/web/api/ovr_multiview2/framebuffertexturemultiviewovr/index.html index 65f86c022edc84e..7d8dd1e9b43d332 100644 --- a/files/en-us/web/api/ovr_multiview2/framebuffertexturemultiviewovr/index.html +++ b/files/en-us/web/api/ovr_multiview2/framebuffertexturemultiviewovr/index.html @@ -19,7 +19,7 @@

    Syntax

    -
    void ext.framebufferTextureMultiviewOVR(target, attachment, texture, level, baseViewIndex, numViews);
    +
    void ext.framebufferTextureMultiviewOVR(target, attachment, texture, level, baseViewIndex, numViews);
     

    Parameters

    diff --git a/files/en-us/web/api/pannernode/orientationx/index.html b/files/en-us/web/api/pannernode/orientationx/index.html index 666c11a92b98e4b..1d391ae811422ab 100644 --- a/files/en-us/web/api/pannernode/orientationx/index.html +++ b/files/en-us/web/api/pannernode/orientationx/index.html @@ -38,7 +38,7 @@

    Syntax

    -
    var orientationX = PannerNode.orientationX;
    +
    var orientationX = PannerNode.orientationX;
     
     PannerNode.orientationX.value = newOrientationX;
     
    diff --git a/files/en-us/web/api/pannernode/orientationy/index.html b/files/en-us/web/api/pannernode/orientationy/index.html index 0bbb94d69d176c6..da8c5e385df2dbd 100644 --- a/files/en-us/web/api/pannernode/orientationy/index.html +++ b/files/en-us/web/api/pannernode/orientationy/index.html @@ -39,7 +39,7 @@

    Syntax

    -
    var orientationY = PannerNode.orientationY;
    +
    var orientationY = PannerNode.orientationY;
     
     PannerNode.orientationY.value = newOrientationY;
     
    diff --git a/files/en-us/web/api/pannernode/orientationz/index.html b/files/en-us/web/api/pannernode/orientationz/index.html index 1709096f2d2eae7..4986392080df6ca 100644 --- a/files/en-us/web/api/pannernode/orientationz/index.html +++ b/files/en-us/web/api/pannernode/orientationz/index.html @@ -37,7 +37,7 @@

    Syntax

    -
    var orientationZ = PannerNode.orientationZ;
    +
    var orientationZ = PannerNode.orientationZ;
     
     PannerNode.orientationZ.value = newOrientationZ;
     
    diff --git a/files/en-us/web/api/pannernode/positionx/index.html b/files/en-us/web/api/pannernode/positionx/index.html index 632806a13eb1bf6..77ed4ab77858fd6 100644 --- a/files/en-us/web/api/pannernode/positionx/index.html +++ b/files/en-us/web/api/pannernode/positionx/index.html @@ -39,7 +39,7 @@

    Syntax

    -
    var positionX = PannerNode.positionX;
    +
    var positionX = PannerNode.positionX;
     
     PannerNode.positionX.value = newPositionX;
     
    diff --git a/files/en-us/web/api/pannernode/positiony/index.html b/files/en-us/web/api/pannernode/positiony/index.html index e0229c2130ba152..2a85806228db4b2 100644 --- a/files/en-us/web/api/pannernode/positiony/index.html +++ b/files/en-us/web/api/pannernode/positiony/index.html @@ -38,7 +38,7 @@

    Syntax

    -
    var positionY = PannerNode.positionY;
    +
    var positionY = PannerNode.positionY;
     
     PannerNode.positionY.value = newPositionY;
     
    diff --git a/files/en-us/web/api/pannernode/positionz/index.html b/files/en-us/web/api/pannernode/positionz/index.html index 7ae310c0ccaef89..734fea755625492 100644 --- a/files/en-us/web/api/pannernode/positionz/index.html +++ b/files/en-us/web/api/pannernode/positionz/index.html @@ -38,7 +38,7 @@

    Syntax

    -
    var positionZ = PannerNode.positionZ;
    +
    var positionZ = PannerNode.positionZ;
     
     PannerNode.positionZ.value = newPositionZ;
     
    diff --git a/files/en-us/web/api/paymentaddress/addressline/index.html b/files/en-us/web/api/paymentaddress/addressline/index.html index 2e804cf8e8c82d0..5625504c98b3479 100644 --- a/files/en-us/web/api/paymentaddress/addressline/index.html +++ b/files/en-us/web/api/paymentaddress/addressline/index.html @@ -25,7 +25,7 @@

    Syntax

    var paymentAddressLines = PaymentAddress.addressLine;
    + class="brush: js">var paymentAddressLines = PaymentAddress.addressLine;

    Value

    diff --git a/files/en-us/web/api/paymentaddress/city/index.html b/files/en-us/web/api/paymentaddress/city/index.html index c95e3fb9ec7ce9c..9d640d956222753 100644 --- a/files/en-us/web/api/paymentaddress/city/index.html +++ b/files/en-us/web/api/paymentaddress/city/index.html @@ -25,7 +25,7 @@

    Syntax

    var paymentCity = PaymentAddress.city;
    + class="brush: js">var paymentCity = PaymentAddress.city;

    Value

    diff --git a/files/en-us/web/api/paymentaddress/country/index.html b/files/en-us/web/api/paymentaddress/country/index.html index 84b5a4340c8ab0b..57438b76934f343 100644 --- a/files/en-us/web/api/paymentaddress/country/index.html +++ b/files/en-us/web/api/paymentaddress/country/index.html @@ -26,7 +26,7 @@

    Syntax

    var paymentCountry = PaymentAddress.country;
    + class="brush: js">var paymentCountry = PaymentAddress.country;

    Value

    diff --git a/files/en-us/web/api/paymentaddress/dependentlocality/index.html b/files/en-us/web/api/paymentaddress/dependentlocality/index.html index a94f39eef188076..8fa70b51751afc9 100644 --- a/files/en-us/web/api/paymentaddress/dependentlocality/index.html +++ b/files/en-us/web/api/paymentaddress/dependentlocality/index.html @@ -21,7 +21,7 @@

    Syntax

    var paymentDependentLocality = PaymentAddress.dependentLocality;
    + class="brush: js">var paymentDependentLocality = PaymentAddress.dependentLocality;

    Value

    diff --git a/files/en-us/web/api/paymentaddress/languagecode/index.html b/files/en-us/web/api/paymentaddress/languagecode/index.html index 7fafea973f9f447..a2be77c452a33ba 100644 --- a/files/en-us/web/api/paymentaddress/languagecode/index.html +++ b/files/en-us/web/api/paymentaddress/languagecode/index.html @@ -29,7 +29,7 @@

    Syntax

    var paymentLanguageCode = PaymentAddress.languageCode;
    + class="brush: js">var paymentLanguageCode = PaymentAddress.languageCode;

    Value

    diff --git a/files/en-us/web/api/paymentaddress/organization/index.html b/files/en-us/web/api/paymentaddress/organization/index.html index f97b311683f7fe1..60530163c5f931f 100644 --- a/files/en-us/web/api/paymentaddress/organization/index.html +++ b/files/en-us/web/api/paymentaddress/organization/index.html @@ -25,7 +25,7 @@

    Syntax

    var paymentOrganization = PaymentAddress.organization;
    + class="brush: js">var paymentOrganization = PaymentAddress.organization;

    Value

    diff --git a/files/en-us/web/api/paymentaddress/phone/index.html b/files/en-us/web/api/paymentaddress/phone/index.html index bdd62b3b9da94d8..ca27ec6a6888fc7 100644 --- a/files/en-us/web/api/paymentaddress/phone/index.html +++ b/files/en-us/web/api/paymentaddress/phone/index.html @@ -25,7 +25,7 @@

    Syntax

    var paymentPhone = PaymentAddress.phone;
    + class="brush: js">var paymentPhone = PaymentAddress.phone;

    Value

    diff --git a/files/en-us/web/api/paymentaddress/postalcode/index.html b/files/en-us/web/api/paymentaddress/postalcode/index.html index 50f36ba62195ec8..b7dc5b4211ae4d6 100644 --- a/files/en-us/web/api/paymentaddress/postalcode/index.html +++ b/files/en-us/web/api/paymentaddress/postalcode/index.html @@ -31,7 +31,7 @@

    Syntax

    var paymentPostalCode = PaymentAddress.postalCode;
    + class="brush: js">var paymentPostalCode = PaymentAddress.postalCode;

    Value

    diff --git a/files/en-us/web/api/paymentaddress/recipient/index.html b/files/en-us/web/api/paymentaddress/recipient/index.html index 44f6742592e063c..51215fd18d936b9 100644 --- a/files/en-us/web/api/paymentaddress/recipient/index.html +++ b/files/en-us/web/api/paymentaddress/recipient/index.html @@ -19,7 +19,7 @@

    Syntax

    var paymentRecipient = PaymentAddress.recipient;
    + class="brush: js">var paymentRecipient = PaymentAddress.recipient;

    Value

    diff --git a/files/en-us/web/api/paymentaddress/region/index.html b/files/en-us/web/api/paymentaddress/region/index.html index 8a69cc6097d0d98..55d0a8fd05f9c3d 100644 --- a/files/en-us/web/api/paymentaddress/region/index.html +++ b/files/en-us/web/api/paymentaddress/region/index.html @@ -28,7 +28,7 @@

    Syntax

    var paymentRegion = PaymentAddress.region;
    + class="brush: js">var paymentRegion = PaymentAddress.region;

    Value

    diff --git a/files/en-us/web/api/paymentaddress/regioncode/index.html b/files/en-us/web/api/paymentaddress/regioncode/index.html index b429e1bae5313f5..6097d6368b2bc57 100644 --- a/files/en-us/web/api/paymentaddress/regioncode/index.html +++ b/files/en-us/web/api/paymentaddress/regioncode/index.html @@ -35,7 +35,7 @@

    Syntax

    var regionCode = paymentAddress.regionCode;
    + class="brush: js">var regionCode = paymentAddress.regionCode;

    Value

    diff --git a/files/en-us/web/api/paymentaddress/sortingcode/index.html b/files/en-us/web/api/paymentaddress/sortingcode/index.html index 8c786d40e49b77c..772a8c8b771e400 100644 --- a/files/en-us/web/api/paymentaddress/sortingcode/index.html +++ b/files/en-us/web/api/paymentaddress/sortingcode/index.html @@ -23,7 +23,7 @@

    Syntax

    var sortingCode = PaymentAddress.sortingCode;
    + class="brush: js">var sortingCode = PaymentAddress.sortingCode;

    Value

    diff --git a/files/en-us/web/api/paymentaddress/tojson/index.html b/files/en-us/web/api/paymentaddress/tojson/index.html index fa3b9c62f68dacb..0bb46b2b1a3fb8b 100644 --- a/files/en-us/web/api/paymentaddress/tojson/index.html +++ b/files/en-us/web/api/paymentaddress/tojson/index.html @@ -20,7 +20,7 @@

    Syntax

    var json = PaymentAddress.toJSON()
    + class="brush: js">var json = PaymentAddress.toJSON()

    Parameters

    diff --git a/files/en-us/web/api/pictureinpicturewindow/height/index.html b/files/en-us/web/api/pictureinpicturewindow/height/index.html index 38e2fb6eaac7120..65039568ad5f1c0 100644 --- a/files/en-us/web/api/pictureinpicturewindow/height/index.html +++ b/files/en-us/web/api/pictureinpicturewindow/height/index.html @@ -18,7 +18,7 @@

    Syntax

    -
    let height = pictureInPictureWindow.height;
    +
    let height = pictureInPictureWindow.height;

    Value

    diff --git a/files/en-us/web/api/pictureinpicturewindow/index.html b/files/en-us/web/api/pictureinpicturewindow/index.html index 4f0ffebdc623e36..fd6fb056ba74427 100644 --- a/files/en-us/web/api/pictureinpicturewindow/index.html +++ b/files/en-us/web/api/pictureinpicturewindow/index.html @@ -45,7 +45,7 @@

    Examples

    Given a <button> and a <video>, clicking the button will make the video enter the picture-in-picture mode; we then attach an event to print the floating video window dimensions to the console.

    -
    const button = document.querySelector("button");
    +
    const button = document.querySelector("button");
     const video = document.querySelector("video");
     
     function printPipWindowDimensions(evt) {
    diff --git a/files/en-us/web/api/pictureinpicturewindow/onresize/index.html b/files/en-us/web/api/pictureinpicturewindow/onresize/index.html
    index fb2799d0aefac46..76abfcbd5fb7b3f 100644
    --- a/files/en-us/web/api/pictureinpicturewindow/onresize/index.html
    +++ b/files/en-us/web/api/pictureinpicturewindow/onresize/index.html
    @@ -22,7 +22,7 @@
     
     

    Syntax

    -
    pictureInPictureWindow.onresize = functionRef;
    +
    pictureInPictureWindow.onresize = functionRef;
     

    Value

    @@ -36,13 +36,13 @@

    Examples

    Window size logger

    -
    <p>Resize the floating video window to fire the <code>resize</code> event.</p>
    +
    <p>Resize the floating video window to fire the <code>resize</code> event.</p>
     <p>Window height: <span id="height"></span></p>
     <p>Window width: <span id="width"></span></p>
     <video id="video" muted autoplay src=""></video>
     
    -
    const video = document.querySelector('#video');
    +
    const video = document.querySelector('#video');
     const heightOutput = document.querySelector('#height');
     const widthOutput = document.querySelector('#width');
     
    diff --git a/files/en-us/web/api/pictureinpicturewindow/resize_event/index.html b/files/en-us/web/api/pictureinpicturewindow/resize_event/index.html
    index e5a7cfcfec8363a..5dcae5dfc3712a1 100644
    --- a/files/en-us/web/api/pictureinpicturewindow/resize_event/index.html
    +++ b/files/en-us/web/api/pictureinpicturewindow/resize_event/index.html
    @@ -39,13 +39,13 @@ 

    Examples

    Window size logger

    -
    <p>Resize the floating video window to fire the <code>resize</code> event.</p>
    +
    <p>Resize the floating video window to fire the <code>resize</code> event.</p>
     <p>Window height: <span id="height"></span></p>
     <p>Window width: <span id="width"></span></p>
     <video id="video" src="" muted autoplay></video>
     
    -
    const video = document.querySelector('#video');
    +
    const video = document.querySelector('#video');
     const heightOutput = document.querySelector('#height');
     const widthOutput = document.querySelector('#width');
     
    @@ -63,7 +63,7 @@ 

    addEventListener equivalent

    You could set up the event handler using the addEventListener() method:

    -
    pictureInPictureWindow.addEventListener('resize', resize);
    +
    pictureInPictureWindow.addEventListener('resize', resize);

    Specifications

    diff --git a/files/en-us/web/api/pictureinpicturewindow/width/index.html b/files/en-us/web/api/pictureinpicturewindow/width/index.html index 9bd6e65d48072c8..5f19945900a7a62 100644 --- a/files/en-us/web/api/pictureinpicturewindow/width/index.html +++ b/files/en-us/web/api/pictureinpicturewindow/width/index.html @@ -18,7 +18,7 @@

    Syntax

    -
    let width = pictureInPictureWindow.width;
    +
    let width = pictureInPictureWindow.width;

    Value

    diff --git a/files/en-us/web/api/pointerevent/getcoalescedevents/index.html b/files/en-us/web/api/pointerevent/getcoalescedevents/index.html index 3f13f11a3e7d348..843bd7af5a651bd 100644 --- a/files/en-us/web/api/pointerevent/getcoalescedevents/index.html +++ b/files/en-us/web/api/pointerevent/getcoalescedevents/index.html @@ -19,7 +19,7 @@

    Syntax

    var pointerEvents[] = PointerEvent.getCoalescedEvents()
    + class="brush: js">var pointerEvents[] = PointerEvent.getCoalescedEvents()

    Parameters

    diff --git a/files/en-us/web/api/pointerevent/height/index.html b/files/en-us/web/api/pointerevent/height/index.html index 30f5aa5c2b66b98..769c3530650f936 100644 --- a/files/en-us/web/api/pointerevent/height/index.html +++ b/files/en-us/web/api/pointerevent/height/index.html @@ -22,7 +22,7 @@

    Syntax

    -
    var contactHeight = pointerEvent.height;
    +
    var contactHeight = pointerEvent.height;
     

    Return value

    diff --git a/files/en-us/web/api/pointerevent/isprimary/index.html b/files/en-us/web/api/pointerevent/isprimary/index.html index f60d89d98deb489..fae7222eca2cfc5 100644 --- a/files/en-us/web/api/pointerevent/isprimary/index.html +++ b/files/en-us/web/api/pointerevent/isprimary/index.html @@ -40,7 +40,7 @@

    Syntax

    -
    var isPrimary = pointerEvent.isPrimary;
    +
    var isPrimary = pointerEvent.isPrimary;
     

    Return value

    @@ -56,7 +56,7 @@

    Example

    This example illustrates using the value of isPrimary to call the appropriate processing function.

    -
    target.addEventListener('pointerdown', function(event) {
    +
    target.addEventListener('pointerdown', function(event) {
       if (event.isPrimary)
         process_primary_pointer(event);
       else
    diff --git a/files/en-us/web/api/pointerevent/pointerevent/index.html b/files/en-us/web/api/pointerevent/pointerevent/index.html
    index cec619f00bbdfa0..632f2fa6d240494 100644
    --- a/files/en-us/web/api/pointerevent/pointerevent/index.html
    +++ b/files/en-us/web/api/pointerevent/pointerevent/index.html
    @@ -15,7 +15,7 @@
     

    Syntax

     event = new PointerEvent(type, PointerEventInit);
    + class="brush: js"> event = new PointerEvent(type, PointerEventInit);

    Arguments

    diff --git a/files/en-us/web/api/pointerevent/pointerid/index.html b/files/en-us/web/api/pointerevent/pointerid/index.html index 9c6ef2fcf7afca5..935548a288595e2 100644 --- a/files/en-us/web/api/pointerevent/pointerid/index.html +++ b/files/en-us/web/api/pointerevent/pointerid/index.html @@ -19,7 +19,7 @@

    Syntax

    -
    var id = pointerEvent.pointerId;
    +
    var id = pointerEvent.pointerId;
     

    Return value

    diff --git a/files/en-us/web/api/pointerevent/pointertype/index.html b/files/en-us/web/api/pointerevent/pointertype/index.html index 33ae99989c3ef5d..b2793207d5351a9 100644 --- a/files/en-us/web/api/pointerevent/pointertype/index.html +++ b/files/en-us/web/api/pointerevent/pointertype/index.html @@ -17,7 +17,7 @@

    Syntax

    -
    var pType = pointerEvent.pointerType;
    +
    var pType = pointerEvent.pointerType;
     

    Return value

    diff --git a/files/en-us/web/api/pointerevent/pressure/index.html b/files/en-us/web/api/pointerevent/pressure/index.html index bd8aba68672a8fe..9c8404a5afeda13 100644 --- a/files/en-us/web/api/pointerevent/pressure/index.html +++ b/files/en-us/web/api/pointerevent/pressure/index.html @@ -17,7 +17,7 @@

    Syntax

    -
    var pressure = pointerEvent.pressure;
    +
    var pressure = pointerEvent.pressure;
     

    Return value

    diff --git a/files/en-us/web/api/pointerevent/tangentialpressure/index.html b/files/en-us/web/api/pointerevent/tangentialpressure/index.html index ec5c19ce824cce0..9355b7c4abdb727 100644 --- a/files/en-us/web/api/pointerevent/tangentialpressure/index.html +++ b/files/en-us/web/api/pointerevent/tangentialpressure/index.html @@ -19,7 +19,7 @@

    Syntax

    -
    var tanPressure = pointerEvent.tangentialPressure;
    +
    var tanPressure = pointerEvent.tangentialPressure;
     

    Return value

    diff --git a/files/en-us/web/api/pointerevent/tiltx/index.html b/files/en-us/web/api/pointerevent/tiltx/index.html index ca49b12d008ae51..8817ffbd4e838bf 100644 --- a/files/en-us/web/api/pointerevent/tiltx/index.html +++ b/files/en-us/web/api/pointerevent/tiltx/index.html @@ -22,7 +22,7 @@

    Syntax

    -
    var tiltX = pointerEvent.tiltX;
    +
    var tiltX = pointerEvent.tiltX;
     

    Return value

    diff --git a/files/en-us/web/api/pointerevent/tilty/index.html b/files/en-us/web/api/pointerevent/tilty/index.html index 489d0d66cb1f2cb..e319c59a07c200a 100644 --- a/files/en-us/web/api/pointerevent/tilty/index.html +++ b/files/en-us/web/api/pointerevent/tilty/index.html @@ -22,7 +22,7 @@

    Syntax

    -
    var tiltY = pointerEvent.tiltY;
    +
    var tiltY = pointerEvent.tiltY;
     

    Return value

    diff --git a/files/en-us/web/api/pointerevent/twist/index.html b/files/en-us/web/api/pointerevent/twist/index.html index d368db2035cc646..ce1b3744137f86d 100644 --- a/files/en-us/web/api/pointerevent/twist/index.html +++ b/files/en-us/web/api/pointerevent/twist/index.html @@ -18,7 +18,7 @@

    Syntax

    -
    var twist = pointerEvent.twist;
    +
    var twist = pointerEvent.twist;
     

    Return value

    diff --git a/files/en-us/web/api/pointerevent/width/index.html b/files/en-us/web/api/pointerevent/width/index.html index fd73b68edee40bf..2e90db3c3c0e180 100644 --- a/files/en-us/web/api/pointerevent/width/index.html +++ b/files/en-us/web/api/pointerevent/width/index.html @@ -22,7 +22,7 @@

    Syntax

    -
    var contactWidth = pointerEvent.width;
    +
    var contactWidth = pointerEvent.width;
     

    Return value

    diff --git a/files/en-us/web/api/reportingobserver/disconnect/index.html b/files/en-us/web/api/reportingobserver/disconnect/index.html index 49e63f4d3521981..5026b519906af71 100644 --- a/files/en-us/web/api/reportingobserver/disconnect/index.html +++ b/files/en-us/web/api/reportingobserver/disconnect/index.html @@ -23,7 +23,7 @@

    Syntax

    -
    reportingObserverInstance.disconnect()
    +
    reportingObserverInstance.disconnect()
     

    Examples

    diff --git a/files/en-us/web/api/reportingobserver/observe/index.html b/files/en-us/web/api/reportingobserver/observe/index.html index 22b1a307f755cbe..d9650ee56e902a9 100644 --- a/files/en-us/web/api/reportingobserver/observe/index.html +++ b/files/en-us/web/api/reportingobserver/observe/index.html @@ -18,7 +18,7 @@

    Syntax

    -
    reportingObserverInstance.observe()
    +
    reportingObserverInstance.observe()
     

    Examples

    diff --git a/files/en-us/web/api/reportingobserver/reportingobserver/index.html b/files/en-us/web/api/reportingobserver/reportingobserver/index.html index 683e0de33b93aed..f78c14a44812b50 100644 --- a/files/en-us/web/api/reportingobserver/reportingobserver/index.html +++ b/files/en-us/web/api/reportingobserver/reportingobserver/index.html @@ -18,7 +18,7 @@

    Syntax

    -
    new ReportingObserver(callback[, options]);
    +
    new ReportingObserver(callback[, options]);
     

    Parameters

    diff --git a/files/en-us/web/api/reportingobserver/takerecords/index.html b/files/en-us/web/api/reportingobserver/takerecords/index.html index 47e351ea461151a..60ee71fe510af7f 100644 --- a/files/en-us/web/api/reportingobserver/takerecords/index.html +++ b/files/en-us/web/api/reportingobserver/takerecords/index.html @@ -17,7 +17,7 @@

    Syntax

    -
    reportingObserverInstance.takeRecords()
    +
    reportingObserverInstance.takeRecords()
     

    Return value

    diff --git a/files/en-us/web/api/rtcpeerconnectioniceerrorevent/address/index.html b/files/en-us/web/api/rtcpeerconnectioniceerrorevent/address/index.html index 843e4c45871af70..3b2c86270c44280 100644 --- a/files/en-us/web/api/rtcpeerconnectioniceerrorevent/address/index.html +++ b/files/en-us/web/api/rtcpeerconnectioniceerrorevent/address/index.html @@ -25,7 +25,7 @@

    Syntax

    let address = rtcPeerConnectionIceErrorEvent.address;
    + class="brush: js">let address = rtcPeerConnectionIceErrorEvent.address;

    Value

    @@ -52,7 +52,7 @@

    Examples

    {{domxref("RTCPeerConnectionIceErrorEvent.errorText", "errorText")}} property's contents.

    -
    pc.addEventListener("icecandidateerror", (event) => {
    +
    pc.addEventListener("icecandidateerror", (event) => {
       let networkInfo = `[Local interface: ${event.address}:${event.port}`;
       let iceServerInfo = `[ICE server: ${event.url}`;
     
    diff --git a/files/en-us/web/api/rtcsessiondescription/rtcsessiondescription/index.html b/files/en-us/web/api/rtcsessiondescription/rtcsessiondescription/index.html
    index a082647f1ee9058..aae6e6b76c087f9 100644
    --- a/files/en-us/web/api/rtcsessiondescription/rtcsessiondescription/index.html
    +++ b/files/en-us/web/api/rtcsessiondescription/rtcsessiondescription/index.html
    @@ -28,7 +28,7 @@
     

    Syntax

     sessionDescription = new RTCSessionDescription(rtcSessionDescriptionInit);
    + class="brush: js"> sessionDescription = new RTCSessionDescription(rtcSessionDescriptionInit);

    Values

    diff --git a/files/en-us/web/api/rtcsessiondescription/sdp/index.html b/files/en-us/web/api/rtcsessiondescription/sdp/index.html index 048aa464329ad06..1393a8c552f5327 100644 --- a/files/en-us/web/api/rtcsessiondescription/sdp/index.html +++ b/files/en-us/web/api/rtcsessiondescription/sdp/index.html @@ -17,7 +17,7 @@

    Syntax

    -
    var value = sessionDescription.sdp;
    +
    var value = sessionDescription.sdp;
     sessionDescription.sdp = value;
     
    diff --git a/files/en-us/web/api/rtcsessiondescription/tojson/index.html b/files/en-us/web/api/rtcsessiondescription/tojson/index.html index fd2e048e0d702ad..78dd3e14e819f83 100644 --- a/files/en-us/web/api/rtcsessiondescription/tojson/index.html +++ b/files/en-us/web/api/rtcsessiondescription/tojson/index.html @@ -21,7 +21,7 @@

    Syntax

    -
    var jsonValue = sd.toJSON();
    +
    var jsonValue = sd.toJSON();
     

    The result value is a {{jsxref("JSON")}} object containing the following values:

    diff --git a/files/en-us/web/api/rtcsessiondescription/type/index.html b/files/en-us/web/api/rtcsessiondescription/type/index.html index 8ef701abcdba459..356b788244bf8bd 100644 --- a/files/en-us/web/api/rtcsessiondescription/type/index.html +++ b/files/en-us/web/api/rtcsessiondescription/type/index.html @@ -17,7 +17,7 @@

    Syntax

    -
    var value = sessionDescription.type;
    +
    var value = sessionDescription.type;
     sessionDescription.type = value;
     
    diff --git a/files/en-us/web/api/sharedworker/port/index.html b/files/en-us/web/api/sharedworker/port/index.html index 2f41791f54c3566..01e3379531854ae 100644 --- a/files/en-us/web/api/sharedworker/port/index.html +++ b/files/en-us/web/api/sharedworker/port/index.html @@ -17,7 +17,7 @@

    Syntax

    -
    myWorker.port;
    +
    myWorker.port;

    Value

    diff --git a/files/en-us/web/api/sharedworker/sharedworker/index.html b/files/en-us/web/api/sharedworker/sharedworker/index.html index 9872d256755b8e7..d93107e895ae6b8 100644 --- a/files/en-us/web/api/sharedworker/sharedworker/index.html +++ b/files/en-us/web/api/sharedworker/sharedworker/index.html @@ -24,7 +24,7 @@

    Syntax

    -
    var myWorker = new SharedWorker(aURL, name);
    +
    var myWorker = new SharedWorker(aURL, name);
     var myWorker = new SharedWorker(aURL, options);

    Parameters

    @@ -79,7 +79,7 @@

    Examples

    The following code snippet shows creation of a {{domxref("SharedWorker")}} object using the SharedWorker() constructor and subsequent usage of the object:

    -
    var myWorker = new SharedWorker('worker.js');
    +
    var myWorker = new SharedWorker('worker.js');
     
     myWorker.port.start();
     
    diff --git a/files/en-us/web/api/storageestimate/quota/index.html b/files/en-us/web/api/storageestimate/quota/index.html
    index f222b0280dc33e5..f31060d36c8dabf 100644
    --- a/files/en-us/web/api/storageestimate/quota/index.html
    +++ b/files/en-us/web/api/storageestimate/quota/index.html
    @@ -21,7 +21,7 @@
     
     

    Syntax

    -
    quota = StorageEstimate.quota;
    +
    quota = StorageEstimate.quota;
     

    Value

    diff --git a/files/en-us/web/api/storageestimate/usage/index.html b/files/en-us/web/api/storageestimate/usage/index.html index cd530b82b4fc7a9..34b7c40bf494fa3 100644 --- a/files/en-us/web/api/storageestimate/usage/index.html +++ b/files/en-us/web/api/storageestimate/usage/index.html @@ -21,7 +21,7 @@

    Syntax

    -
    usage = StorageEstimate.usage;
    +
    usage = StorageEstimate.usage;
     

    Value

    diff --git a/files/en-us/web/api/storageevent/index.html b/files/en-us/web/api/storageevent/index.html index 4ded33031c062df..8cff93e162b8a5f 100644 --- a/files/en-us/web/api/storageevent/index.html +++ b/files/en-us/web/api/storageevent/index.html @@ -17,7 +17,7 @@

    Method overview

    -
    void initStorageEvent(
    +
    void initStorageEvent(
       in DOMString type,
       in boolean canBubble,
       in boolean cancelable,
    @@ -84,7 +84,7 @@ 

    initStorageEvent()

    Syntax

    -
    storageEvent.initStorageEvent(type[, canBubble[, cancelable[, key[, oldValue[, newValue[, url[, storageArea]]]]]]])
    +
    storageEvent.initStorageEvent(type[, canBubble[, cancelable[, key[, oldValue[, newValue[, url[, storageArea]]]]]]])
     
    Parameters
    diff --git a/files/en-us/web/api/stylepropertymapreadonly/entries/index.html b/files/en-us/web/api/stylepropertymapreadonly/entries/index.html index 31c0536760ba6be..e5abe3abf7e0986 100644 --- a/files/en-us/web/api/stylepropertymapreadonly/entries/index.html +++ b/files/en-us/web/api/stylepropertymapreadonly/entries/index.html @@ -21,7 +21,7 @@

    Syntax

    -
    StylePropertyMapReadOnly.entries()
    +
    StylePropertyMapReadOnly.entries()

    Parameters

    @@ -37,7 +37,7 @@

    Example

    Here shows an example of using StylePropertyMapReadOnly.entries() method on an elements computed styles.

    -
    // grab a dom element
    +
    // grab a dom element
     const buttonEl = document.querySelector('button');
     
     // we can retrieve all computed styles with `computedStyleMap`
    diff --git a/files/en-us/web/api/stylepropertymapreadonly/foreach/index.html b/files/en-us/web/api/stylepropertymapreadonly/foreach/index.html
    index ac4e662c9de1c7b..ab46edd7e580a52 100644
    --- a/files/en-us/web/api/stylepropertymapreadonly/foreach/index.html
    +++ b/files/en-us/web/api/stylepropertymapreadonly/foreach/index.html
    @@ -18,7 +18,7 @@
     
     

    Syntax

    -
    StylePropertyMapReadOnly.forEach(function callback(currentValue[, index[, array]]) {
    +
    StylePropertyMapReadOnly.forEach(function callback(currentValue[, index[, array]]) {
         //your code
     }[, thisArg]);
    @@ -52,7 +52,7 @@

    Example

    Here is an example of using forEach() on a retrieved {{domxref('Element.computedStyleMap()')}}.

    -
    // get a button element
    +
    // get a button element
     const buttonEl = document.querySelector('.example');
     
     // we can retrieve all computed styles with `computedStyleMap`
    diff --git a/files/en-us/web/api/stylepropertymapreadonly/get/index.html b/files/en-us/web/api/stylepropertymapreadonly/get/index.html
    index 92e36e05abed101..1f3fe012775b3aa 100644
    --- a/files/en-us/web/api/stylepropertymapreadonly/get/index.html
    +++ b/files/en-us/web/api/stylepropertymapreadonly/get/index.html
    @@ -19,7 +19,7 @@
     

    Syntax

    var declarationBlock = StylePropertyMapReadOnly.get(property)
    + class="brush: js">var declarationBlock = StylePropertyMapReadOnly.get(property)

    Parameters

    @@ -38,14 +38,14 @@

    Examples

    paragraph in our HTML, and adding a definition list which we will populate with JavaScript:

    -
    <p>
    +
    <p>
        <a href="https://example.com">Link</a>
     </p>
     <dl id="results"></dl>

    We add a bit of CSS, including a custom property and an inheritable property:

    -
    p {
    +
    p {
       font-weight: bold;
     }
     a {
    @@ -59,7 +59,7 @@ 

    Examples

    of interest and use the StylePropertyMapReadOnly's get() method to get only those values.

    -
    // get the element
    +
    // get the element
     const myElement = document.querySelector('a');
     
     // Retrieve all computed styles with computedStyleMap()
    diff --git a/files/en-us/web/api/stylepropertymapreadonly/getall/index.html b/files/en-us/web/api/stylepropertymapreadonly/getall/index.html
    index c632555f211cf8a..2ca30ade235eb7b 100644
    --- a/files/en-us/web/api/stylepropertymapreadonly/getall/index.html
    +++ b/files/en-us/web/api/stylepropertymapreadonly/getall/index.html
    @@ -21,7 +21,7 @@
     

    Syntax

    var cssStyleValues[] = StylePropertyMapReadOnly.getAll(property)
    + class="brush: js">var cssStyleValues[] = StylePropertyMapReadOnly.getAll(property)

    Parameters

    @@ -40,7 +40,7 @@

    Example

    {{cssxref('background-image')}} property. An {{jsxref('Array')}} is returned which contains an item for each background image declared.

    -
    // get a button element
    +
    // get a button element
     const buttonEl = document.querySelector('button');
     
     // we can retrieve all computed styles with `computedStyleMap`
    diff --git a/files/en-us/web/api/stylepropertymapreadonly/has/index.html b/files/en-us/web/api/stylepropertymapreadonly/has/index.html
    index 81b20e2f3b4cb07..bc568b439b3c964 100644
    --- a/files/en-us/web/api/stylepropertymapreadonly/has/index.html
    +++ b/files/en-us/web/api/stylepropertymapreadonly/has/index.html
    @@ -20,7 +20,7 @@
     

    Syntax

    var boolean = StylePropertyMapReadOnly.has(property)
    + class="brush: js">var boolean = StylePropertyMapReadOnly.has(property)

    Parameters

    @@ -38,7 +38,7 @@

    Example

    Here we use the has() method to see if the padding-top property is present within the button elements style attribute.

    -
    // get the button element
    +
    // get the button element
     const buttonEl = document.querySelector('.example');
     
     // find what's in the style attribute with attributeStyleMap and has()
    diff --git a/files/en-us/web/api/stylepropertymapreadonly/index.html b/files/en-us/web/api/stylepropertymapreadonly/index.html
    index 656b1e1b646412b..5db432063190213 100644
    --- a/files/en-us/web/api/stylepropertymapreadonly/index.html
    +++ b/files/en-us/web/api/stylepropertymapreadonly/index.html
    @@ -44,7 +44,7 @@ 

    Examples

    We have to have an element to observe:

    -
    <p>
    +
    <p>
        This is a paragraph with some text. We can add some CSS, or not. The
        style map will include all the default and inherted CSS property values.
     </p>
    @@ -52,7 +52,7 @@ 

    Examples

    We add a touch of CSS with a custom property to better demonstrate the output:

    -
    p {
    +
    p {
        --someVariable: 1.6em;
        --someOtherVariable: translateX(33vw);
        --anotherVariable: 42;
    @@ -61,7 +61,7 @@ 

    Examples

    We add JavaScript to grab our paragraph and return back a definition list of all the default CSS property values using {{domxref('Element.computedStyleMap()')}}.

    -
    // get the element
    +
    // get the element
     const myElement = document.querySelector('p');
     
     // get the <dl> we'll be populating
    diff --git a/files/en-us/web/api/stylepropertymapreadonly/keys/index.html b/files/en-us/web/api/stylepropertymapreadonly/keys/index.html
    index e89e239af835b24..237301dff1ebe59 100644
    --- a/files/en-us/web/api/stylepropertymapreadonly/keys/index.html
    +++ b/files/en-us/web/api/stylepropertymapreadonly/keys/index.html
    @@ -19,7 +19,7 @@
     
     

    Syntax

    -
    StylePropertyMapReadOnly.keys()
    +
    StylePropertyMapReadOnly.keys()

    Parameters

    @@ -34,7 +34,7 @@

    Example

    In this example we use the keys() method to be able to access the properties within our {{domxref('Element.computedStyleMap()')}}.

    -
    // get a button element
    +
    // get a button element
     const buttonEl = document.querySelector('button');
     
     // we can retrieve all computed styles with `computedStyleMap`
    diff --git a/files/en-us/web/api/stylepropertymapreadonly/size/index.html b/files/en-us/web/api/stylepropertymapreadonly/size/index.html
    index 3744140b2088178..378e5216a3f2990 100644
    --- a/files/en-us/web/api/stylepropertymapreadonly/size/index.html
    +++ b/files/en-us/web/api/stylepropertymapreadonly/size/index.html
    @@ -20,7 +20,7 @@
     

    Syntax

    var size = StylePropertyMapReadOnly.size
    + class="brush: js">var size = StylePropertyMapReadOnly.size

    Value

    @@ -31,7 +31,7 @@

    Example

    Here we use the size property to return the total entries within the button elements {{domxref('Element.computedStyleMap()','computedStyleMap')}}.

    -
    // grab our element
    +
    // grab our element
     const buttonEl = document.querySelector('button');
     
     // we can retrieve all computed styles with `computedStyleMap`
    diff --git a/files/en-us/web/api/stylepropertymapreadonly/values/index.html b/files/en-us/web/api/stylepropertymapreadonly/values/index.html
    index 3961504447fbbee..ed34b282385dffd 100644
    --- a/files/en-us/web/api/stylepropertymapreadonly/values/index.html
    +++ b/files/en-us/web/api/stylepropertymapreadonly/values/index.html
    @@ -19,7 +19,7 @@
     
     

    Syntax

    -
    StylePropertyMapReadOnly.values()
    +
    StylePropertyMapReadOnly.values()

    Parameters

    @@ -36,7 +36,7 @@

    Example

    href="/en-US/docs/Web/API/Element/computedStyleMap">Element.computedStyleMap().

    -
    // get a button element
    +
    // get a button element
     const buttonEl = document.querySelector('button');
     
     // we can retrieve all computed styles with `computedStyleMap`
    diff --git a/files/en-us/web/api/wheelevent/deltamode/index.html b/files/en-us/web/api/wheelevent/deltamode/index.html
    index dcb99f5284cceac..a02363ed638979c 100644
    --- a/files/en-us/web/api/wheelevent/deltamode/index.html
    +++ b/files/en-us/web/api/wheelevent/deltamode/index.html
    @@ -43,7 +43,7 @@
     

    Syntax

    var unit = event.deltaMode;
    + class="brush: js">var unit = event.deltaMode;

    Example

    diff --git a/files/en-us/web/api/wheelevent/deltax/index.html b/files/en-us/web/api/wheelevent/deltax/index.html index 37ef4c5b6019637..4bb3c8696856959 100644 --- a/files/en-us/web/api/wheelevent/deltax/index.html +++ b/files/en-us/web/api/wheelevent/deltax/index.html @@ -19,7 +19,7 @@

    Syntax

    var dX = event.deltaX;
    + class="brush: js">var dX = event.deltaX;

    Example

    diff --git a/files/en-us/web/api/wheelevent/deltay/index.html b/files/en-us/web/api/wheelevent/deltay/index.html index 62d88ffdddeee93..1fa146779a90259 100644 --- a/files/en-us/web/api/wheelevent/deltay/index.html +++ b/files/en-us/web/api/wheelevent/deltay/index.html @@ -19,7 +19,7 @@

    Syntax

    var dY = event.deltaY;
    + class="brush: js">var dY = event.deltaY;

    Example

    diff --git a/files/en-us/web/api/wheelevent/deltaz/index.html b/files/en-us/web/api/wheelevent/deltaz/index.html index 9eda9692188fdae..59d1347a6db3e4f 100644 --- a/files/en-us/web/api/wheelevent/deltaz/index.html +++ b/files/en-us/web/api/wheelevent/deltaz/index.html @@ -20,11 +20,11 @@

    Syntax

    var dZ = event.deltaZ;
    + class="brush: js">var dZ = event.deltaZ;

    Example

    -
    var syntheticEvent = new WheelEvent("syntheticWheel", {"deltaZ": 4, "deltaMode": 0});
    +
    var syntheticEvent = new WheelEvent("syntheticWheel", {"deltaZ": 4, "deltaMode": 0});
     
     console.log(syntheticEvent.deltaZ);
     
    diff --git a/files/en-us/web/api/wheelevent/wheelevent/index.html b/files/en-us/web/api/wheelevent/wheelevent/index.html index e9ce00bf0622d38..4afac4611b2c576 100644 --- a/files/en-us/web/api/wheelevent/wheelevent/index.html +++ b/files/en-us/web/api/wheelevent/wheelevent/index.html @@ -15,7 +15,7 @@

    Syntax

    -
    var wheelEvent = new WheelEvent(typeArg, wheelEventInit);
    +
    var wheelEvent = new WheelEvent(typeArg, wheelEventInit);
     

    Properties

    diff --git a/files/en-us/web/api/xrpose/emulatedposition/index.html b/files/en-us/web/api/xrpose/emulatedposition/index.html index 4be7e35dd6f3e84..d82db4daa73ccbc 100644 --- a/files/en-us/web/api/xrpose/emulatedposition/index.html +++ b/files/en-us/web/api/xrpose/emulatedposition/index.html @@ -35,7 +35,7 @@

    Syntax

    let emulated = xrPose.emulatedPosition;
    + class="brush: js">let emulated = xrPose.emulatedPosition;

    Value

    diff --git a/files/en-us/web/api/xrpose/transform/index.html b/files/en-us/web/api/xrpose/transform/index.html index 71c3a19f1cc58ea..2f058d8510a7c6c 100644 --- a/files/en-us/web/api/xrpose/transform/index.html +++ b/files/en-us/web/api/xrpose/transform/index.html @@ -28,7 +28,7 @@

    Syntax

    let poseTransform = xrPose.transform;
    + class="brush: js">let poseTransform = xrPose.transform;

    Value

    diff --git a/files/en-us/web/api/xrreferencespace/getoffsetreferencespace/index.html b/files/en-us/web/api/xrreferencespace/getoffsetreferencespace/index.html index 40a2f3691ac272a..0c76a343af5daa3 100644 --- a/files/en-us/web/api/xrreferencespace/getoffsetreferencespace/index.html +++ b/files/en-us/web/api/xrreferencespace/getoffsetreferencespace/index.html @@ -48,7 +48,7 @@

    Syntax

    offsetReferenceSpace = xrReferenceSpace.getOffsetReferenceSpace(originOffset);
    + class="brush: js">offsetReferenceSpace = xrReferenceSpace.getOffsetReferenceSpace(originOffset);

    Parameters

    @@ -83,7 +83,7 @@

    Teleporting or settin

    Upon first creating a scene, you may need to set the user's position within the 3D world. You can do that using getOffsetReferenceSpace().

    -
    xrSession.requestReferenceSpace("local")
    +
    xrSession.requestReferenceSpace("local")
     .then((refSpace) => {
       xrReferenceSpace = refSpace;
       xrReferenceSpace = xrReferenceSpace.getOffsetReferenceSpace(
    @@ -117,7 +117,7 @@ 

    Implementing rotation base events. This prevents the right-clicks from causing the context menu from appearing in the browser.

    -
    canvas.oncontextmenu = (event) => { event.preventDefault(); };
    +
    canvas.oncontextmenu = (event) => { event.preventDefault(); };
     canvas.addEventListener("mousemove", (event) => {
       if (event.buttons & 2) {
         rotateViewBy(event.movementX, event.movementY);
    @@ -131,7 +131,7 @@ 

    Implementing rotation base straight up and straight down. Each time this is called, the new offsets are used to update the current values of mousePitch and mouseYaw.

    -
    let mouseYaw = 0.0;
    +
    let mouseYaw = 0.0;
     let mousePitch = 0.0;
     const inverseOrientation = quat.create();
     const MOUSE_SPEED = 0.003;
    @@ -150,7 +150,7 @@ 

    Implementing rotation base

    Finally, we need code that actually applies the computed yaw and pitch to the viewer's orientation. This function, applyMouseMovement(), handles that:

    -
    function applyMouseMovement(refSpace) {
    +
    function applyMouseMovement(refSpace) {
       if (!mouseYaw && !mousePitch) {
         return refSpace;
       }
    diff --git a/files/en-us/web/api/xrreferencespace/onreset/index.html b/files/en-us/web/api/xrreferencespace/onreset/index.html
    index a86cb548ca9c628..2e6709462a0828e 100644
    --- a/files/en-us/web/api/xrreferencespace/onreset/index.html
    +++ b/files/en-us/web/api/xrreferencespace/onreset/index.html
    @@ -32,7 +32,7 @@
     
     

    Syntax

    -
    xrReferenceSpace.onreset = eventHandler;
    +
    xrReferenceSpace.onreset = eventHandler;
     
     eventHandler = xrReferenceSpace.onreset;
     
    diff --git a/files/en-us/web/api/xrreferencespace/reset_event/index.html b/files/en-us/web/api/xrreferencespace/reset_event/index.html index 90e7c0deeda5bf8..0c29784f4721ef2 100644 --- a/files/en-us/web/api/xrreferencespace/reset_event/index.html +++ b/files/en-us/web/api/xrreferencespace/reset_event/index.html @@ -83,14 +83,14 @@

    Examples

    To add a handler for the reset event, you can use either of two approaches. First, you can use the {{domxref("EventTarget.addEventListener", "addEventListener()")}} method:

    -
    viewerRefSpace.addEventListener("reset", (event) => {
    +
    viewerRefSpace.addEventListener("reset", (event) => {
       /* perform reset related tasks */
     });
     

    The second option is to set the XRReferenceSpace object's {{domxref("XRReferenceSpace.onreset", "onreset")}} event handler property:

    -
    viewerRefSpace.onreset = (event) => {
    +
    viewerRefSpace.onreset = (event) => {
       /* perform reset related tasks */
     };
     
    diff --git a/files/en-us/web/api/xrsession/cancelanimationframe/index.html b/files/en-us/web/api/xrsession/cancelanimationframe/index.html index 620a04f0fd4136c..f50a4c97fe91287 100644 --- a/files/en-us/web/api/xrsession/cancelanimationframe/index.html +++ b/files/en-us/web/api/xrsession/cancelanimationframe/index.html @@ -25,7 +25,7 @@

    Syntax

    -
    xrSession.cancelAnimationFrame(handle);
    +
    xrSession.cancelAnimationFrame(handle);
     

    Parameters

    diff --git a/files/en-us/web/api/xrsession/end/index.html b/files/en-us/web/api/xrsession/end/index.html index 1c4e4a10c8c2daa..43f6f6d0a7ed833 100644 --- a/files/en-us/web/api/xrsession/end/index.html +++ b/files/en-us/web/api/xrsession/end/index.html @@ -23,7 +23,7 @@

    Syntax

    -
    xrSession.end();
    +
    xrSession.end();
     

    Parameters

    diff --git a/files/en-us/web/api/xrsession/environmentblendmode/index.html b/files/en-us/web/api/xrsession/environmentblendmode/index.html index 97a69882a4f526e..30b8a0af4d17d82 100644 --- a/files/en-us/web/api/xrsession/environmentblendmode/index.html +++ b/files/en-us/web/api/xrsession/environmentblendmode/index.html @@ -38,7 +38,7 @@

    Syntax

    blendMode = xrSession.environmentBlendMode;
    + class="brush: js">blendMode = xrSession.environmentBlendMode;

    Value

    diff --git a/files/en-us/web/api/xrsession/inputsources/index.html b/files/en-us/web/api/xrsession/inputsources/index.html index 5bc60b42d2a783f..829359e95481ede 100644 --- a/files/en-us/web/api/xrsession/inputsources/index.html +++ b/files/en-us/web/api/xrsession/inputsources/index.html @@ -33,7 +33,7 @@

    Syntax

    inputSources = xrSession.inputSources;
    + class="brush: js">inputSources = xrSession.inputSources;

    Value

    diff --git a/files/en-us/web/api/xrsession/onend/index.html b/files/en-us/web/api/xrsession/onend/index.html index ab945dbd2edbaa9..41c219cf5c2b2f2 100644 --- a/files/en-us/web/api/xrsession/onend/index.html +++ b/files/en-us/web/api/xrsession/onend/index.html @@ -24,7 +24,7 @@

    Syntax

    -
    XRSession.onend = function(event) { ... };
    +
    XRSession.onend = function(event) { ... };
     

    Example

    diff --git a/files/en-us/web/api/xrsession/onselect/index.html b/files/en-us/web/api/xrsession/onselect/index.html index 33d5d195d384f23..d1b855ca11d482b 100644 --- a/files/en-us/web/api/xrsession/onselect/index.html +++ b/files/en-us/web/api/xrsession/onselect/index.html @@ -36,7 +36,7 @@

    Syntax

    -
    xrSession.onselect = selectHandlerFunction;
    +
    xrSession.onselect = selectHandlerFunction;
     

    Value

    diff --git a/files/en-us/web/api/xrsession/onselectend/index.html b/files/en-us/web/api/xrsession/onselectend/index.html index 978f46aaf73088f..8459f8d72400aba 100644 --- a/files/en-us/web/api/xrsession/onselectend/index.html +++ b/files/en-us/web/api/xrsession/onselectend/index.html @@ -29,7 +29,7 @@

    Syntax

    -
    XRSession.onselectend = function(event) { ... }
    +
    XRSession.onselectend = function(event) { ... }
     

    Example

    diff --git a/files/en-us/web/api/xrsession/onselectstart/index.html b/files/en-us/web/api/xrsession/onselectstart/index.html index 0562f61d42ab607..eea67bb7e88b4ec 100644 --- a/files/en-us/web/api/xrsession/onselectstart/index.html +++ b/files/en-us/web/api/xrsession/onselectstart/index.html @@ -31,7 +31,7 @@

    Syntax

    -
    XRSession.onselectstart = function(event) { ... }
    +
    XRSession.onselectstart = function(event) { ... }
     

    Example

    diff --git a/files/en-us/web/api/xrsession/onsqueeze/index.html b/files/en-us/web/api/xrsession/onsqueeze/index.html index 4eb4a61837b0d90..b0e7ef6f2da131c 100644 --- a/files/en-us/web/api/xrsession/onsqueeze/index.html +++ b/files/en-us/web/api/xrsession/onsqueeze/index.html @@ -36,7 +36,7 @@

    Syntax

    xrSession.onsqueeze = squeezeHandlerFunction;
    + class="brush: js">xrSession.onsqueeze = squeezeHandlerFunction;

    Value

    diff --git a/files/en-us/web/api/xrsession/onsqueezeend/index.html b/files/en-us/web/api/xrsession/onsqueezeend/index.html index 8361c2f4c4966a4..1a29bbf9c15a809 100644 --- a/files/en-us/web/api/xrsession/onsqueezeend/index.html +++ b/files/en-us/web/api/xrsession/onsqueezeend/index.html @@ -40,7 +40,7 @@

    Syntax

    xrSession.onsqueezeend = squeezeendHandlerFunction;
    + class="brush: js">xrSession.onsqueezeend = squeezeendHandlerFunction;

    Value

    diff --git a/files/en-us/web/api/xrsession/onsqueezestart/index.html b/files/en-us/web/api/xrsession/onsqueezestart/index.html index 6cda77d99d7dd62..ab8837d94d50e13 100644 --- a/files/en-us/web/api/xrsession/onsqueezestart/index.html +++ b/files/en-us/web/api/xrsession/onsqueezestart/index.html @@ -37,7 +37,7 @@

    Syntax

    xrSession.onsqueezestart = squeezestartHandlerFunction;
    + class="brush: js">xrSession.onsqueezestart = squeezestartHandlerFunction;

    Value

    diff --git a/files/en-us/web/api/xrsession/onvisibilitychange/index.html b/files/en-us/web/api/xrsession/onvisibilitychange/index.html index 31e014e10478f2a..eb2aa985f81939f 100644 --- a/files/en-us/web/api/xrsession/onvisibilitychange/index.html +++ b/files/en-us/web/api/xrsession/onvisibilitychange/index.html @@ -29,7 +29,7 @@

    Syntax

    -
    XRSession.onvisibilitychange = function(event) { ... }
    +
    XRSession.onvisibilitychange = function(event) { ... }
     

    Example

    diff --git a/files/en-us/web/api/xrsession/renderstate/index.html b/files/en-us/web/api/xrsession/renderstate/index.html index e1690a1a134dc89..a7a490ff5a28663 100644 --- a/files/en-us/web/api/xrsession/renderstate/index.html +++ b/files/en-us/web/api/xrsession/renderstate/index.html @@ -31,7 +31,7 @@

    Syntax

    var xrRenderState = XRSession.renderState;
    + class="brush: js">var xrRenderState = XRSession.renderState;

    Value

    diff --git a/files/en-us/web/api/xrsession/requestanimationframe/index.html b/files/en-us/web/api/xrsession/requestanimationframe/index.html index dd46614db213888..e77aa61c2e41db9 100644 --- a/files/en-us/web/api/xrsession/requestanimationframe/index.html +++ b/files/en-us/web/api/xrsession/requestanimationframe/index.html @@ -43,7 +43,7 @@

    Syntax

    -
    requestID = xrSession.requestAnimationFrame(animationFrameCallback);
    +
    requestID = xrSession.requestAnimationFrame(animationFrameCallback);
     

    Parameters

    diff --git a/files/en-us/web/api/xrsession/requestreferencespace/index.html b/files/en-us/web/api/xrsession/requestreferencespace/index.html index 039bb51ddede9e6..4b8a62fac5ba181 100644 --- a/files/en-us/web/api/xrsession/requestreferencespace/index.html +++ b/files/en-us/web/api/xrsession/requestreferencespace/index.html @@ -30,7 +30,7 @@

    Syntax

    refSpacePromise = xrSession.requestReferenceSpace(referenceSpaceType);
    + class="brush: js">refSpacePromise = xrSession.requestReferenceSpace(referenceSpaceType);

    Parameters

    diff --git a/files/en-us/web/api/xrsession/updaterenderstate/index.html b/files/en-us/web/api/xrsession/updaterenderstate/index.html index 876ed3ce02add0f..ed65db83d93c01a 100644 --- a/files/en-us/web/api/xrsession/updaterenderstate/index.html +++ b/files/en-us/web/api/xrsession/updaterenderstate/index.html @@ -29,7 +29,7 @@

    Syntax

    xrSession.updateRenderState(newState)
    + class="brush: js">xrSession.updateRenderState(newState)

    Parameters

    diff --git a/files/en-us/web/api/xrsession/visibilitystate/index.html b/files/en-us/web/api/xrsession/visibilitystate/index.html index a5652ef1e2e9bdb..079e4b461670967 100644 --- a/files/en-us/web/api/xrsession/visibilitystate/index.html +++ b/files/en-us/web/api/xrsession/visibilitystate/index.html @@ -30,7 +30,7 @@

    Syntax

    visibilityState = xrSession.visibilityState;
    + class="brush: js">visibilityState = xrSession.visibilityState;

    Value

    diff --git a/files/en-us/web/javascript/a_re-introduction_to_javascript/index.html b/files/en-us/web/javascript/a_re-introduction_to_javascript/index.html index 1bea7e37dc9b892..88ab003742858d9 100644 --- a/files/en-us/web/javascript/a_re-introduction_to_javascript/index.html +++ b/files/en-us/web/javascript/a_re-introduction_to_javascript/index.html @@ -63,33 +63,33 @@

    Numbers

    Numbers in JavaScript are "double-precision 64-bit format IEEE 754 values", according to the spec —  There's no such thing as an integer in JavaScript (except {{jsxref("BigInt")}}), so you have to be a little careful. See this example:

    -
    console.log(3 / 2);             // 1.5, not 1
    +
    console.log(3 / 2);             // 1.5, not 1
     console.log(Math.floor(3 / 2)); // 1

    So an apparent integer is in fact implicitly a float.

    Also, watch out for stuff like:

    -
    0.1 + 0.2 == 0.30000000000000004;
    +
    0.1 + 0.2 == 0.30000000000000004;
     

    In practice, integer values are treated as 32-bit ints, and some implementations even store it that way until they are asked to perform an instruction that's valid on a Number but not on a 32-bit integer. This can be important for bit-wise operations.

    The standard arithmetic operators are supported, including addition, subtraction, modulus (or remainder) arithmetic, and so forth. There's also a built-in object that we did not mention earlier called {{jsxref("Math")}} that provides advanced mathematical functions and constants:

    -
    Math.sin(3.5);
    +
    Math.sin(3.5);
     var circumference = 2 * Math.PI * r;
     

    You can convert a string to an integer using the built-in {{jsxref("Global_Objects/parseInt", "parseInt()")}} function. This takes the base for the conversion as an optional second argument, which you should always provide:

    -
    parseInt('123', 10); // 123
    +
    parseInt('123', 10); // 123
     parseInt('010', 10); // 10
     

    In older browsers, strings beginning with a "0" are assumed to be in octal (radix 8), but this hasn't been the case since 2013 or so. Unless you're certain of your string format, you can get surprising results on those older browsers:

    -
    parseInt('010');  //  8
    +
    parseInt('010');  //  8
     parseInt('0x10'); // 16
     
    @@ -97,42 +97,42 @@

    Numbers

    If you want to convert a binary number to an integer, just change the base:

    -
    parseInt('11', 2); // 3
    +
    parseInt('11', 2); // 3
     

    Similarly, you can parse floating point numbers using the built-in {{jsxref("Global_Objects/parseFloat", "parseFloat()")}} function. Unlike its {{jsxref("Global_Objects/parseInt", "parseInt()")}} cousin, parseFloat() always uses base 10.

    You can also use the unary + operator to convert values to numbers:

    -
    + '42';   // 42
    +
    + '42';   // 42
     + '010';  // 10
     + '0x10'; // 16
     

    A special value called {{jsxref("NaN")}} (short for "Not a Number") is returned if the string is non-numeric:

    -
    parseInt('hello', 10); // NaN
    +
    parseInt('hello', 10); // NaN
     

    NaN is toxic: if you provide it as an operand to any mathematical operation, the result will also be NaN:

    -
    NaN + 5; // NaN
    +
    NaN + 5; // NaN
     

    You can test for NaN using the built-in {{jsxref("Global_Objects/isNaN", "isNaN()")}} function:

    -
    isNaN(NaN); // true
    +
    isNaN(NaN); // true
     

    JavaScript also has the special values {{jsxref("Infinity")}} and -Infinity:

    -
     1 / 0; //  Infinity
    +
     1 / 0; //  Infinity
     -1 / 0; // -Infinity
     

    You can test for Infinity, -Infinity and NaN values using the built-in {{jsxref("Global_Objects/isFinite", "isFinite()")}} function:

    -
    isFinite(1 / 0); // false
    +
    isFinite(1 / 0); // false
     isFinite(-Infinity); // false
     isFinite(NaN); // false
     
    @@ -147,12 +147,12 @@

    Strings

    To find the length of a string (in code units), access its length property:

    -
    'hello'.length; // 5
    +
    'hello'.length; // 5
     

    There's our first brush with JavaScript objects! Did we mention that you can use strings like {{jsxref("Object", "objects", "", 1)}} too? They have {{jsxref("String", "methods", "#Methods", 1)}} as well that allow you to manipulate the string and access information about the string:

    -
    'hello'.charAt(0); // "h"
    +
    'hello'.charAt(0); // "h"
     'hello, world'.replace('world', 'mars'); // "hello, mars"
     'hello'.toUpperCase(); // "HELLO"
     
    @@ -170,7 +170,7 @@

    Other types

    You can perform this conversion explicitly using the Boolean() function:

    -
    Boolean('');  // false
    +
    Boolean('');  // false
     Boolean(234); // true
     
    @@ -184,13 +184,13 @@

    Variables


    let allows you to declare block-level variables. The declared variable is available from the block it is enclosed in.

    -
    let a;
    +
    let a;
     let name = 'Simon';
     

    The following is an example of scope with a variable declared with let:

    -
    // myLetVariable is *not* visible out here
    +
    // myLetVariable is *not* visible out here
     
     for (let myLetVariable = 0; myLetVariable < 5; myLetVariable++) {
       // myLetVariable is only visible in here
    @@ -202,18 +202,18 @@ 

    Variables

    const allows you to declare variables whose values are never intended to change. The variable is available from the block it is declared in.

    -
    const Pi = 3.14; // variable Pi is set
    +
    const Pi = 3.14; // variable Pi is set
     Pi = 1; // will throw an error because you cannot change a constant variable.


    var is the most common declarative keyword. It does not have the restrictions that the other two keywords have. This is because it was traditionally the only way to declare a variable in JavaScript. A variable declared with the var keyword is available from the function it is declared in.

    -
    var a;
    +
    var a;
     var name = 'Simon';

    An example of scope with a variable declared with var:

    -
    // myVarVariable *is* visible out here
    +
    // myVarVariable *is* visible out here
     
     for (var myVarVariable = 0; myVarVariable < 5; myVarVariable++) {
       // myVarVariable is visible to the whole function
    @@ -230,7 +230,7 @@ 

    Operators

    JavaScript's numeric operators are +, -, *, / and % which is the remainder operator (which is the same as modulo.) Values are assigned using =, and there are also compound assignment statements such as += and -=. These extend out to x = x operator y.

    -
    x += 5;
    +
    x += 5;
     x = x + 5;
     
    @@ -238,12 +238,12 @@

    Operators

    The + operator also does string concatenation:

    -
    'hello' + ' world'; // "hello world"
    +
    'hello' + ' world'; // "hello world"
     

    If you add a string to a number (or other value) everything is converted into a string first. This might trip you up:

    -
    '3' + 4 + 5;  // "345"
    +
    '3' + 4 + 5;  // "345"
      3 + 4 + '5'; // "75"
     
    @@ -251,13 +251,13 @@

    Operators

    Comparisons in JavaScript can be made using <, >, <= and >=. These work for both strings and numbers. Equality is a little less straightforward. The double-equals operator performs type coercion if you give it different types, with sometimes interesting results:

    -
    123 == '123'; // true
    +
    123 == '123'; // true
     1 == true; // true
     

    To avoid type coercion, use the triple-equals operator:

    -
    123 === '123'; // false
    +
    123 === '123'; // false
     1 === true;    // false
     
    @@ -269,7 +269,7 @@

    Control structures

    JavaScript has a similar set of control structures to other languages in the C family. Conditional statements are supported by if and else; you can chain them together if you like:

    -
    var name = 'kittens';
    +
    var name = 'kittens';
     if (name == 'puppies') {
       name += ' woof';
     } else if (name == 'kittens') {
    @@ -282,7 +282,7 @@ 

    Control structures

    JavaScript has while loops and do-while loops. The first is good for basic looping; the second for loops where you wish to ensure that the body of the loop is executed at least once:

    -
    while (true) {
    +
    while (true) {
       // an infinite loop!
     }
     
    @@ -294,43 +294,43 @@ 

    Control structures

    JavaScript's for loop is the same as that in C and Java: it lets you provide the control information for your loop on a single line.

    -
    for (var i = 0; i < 5; i++) {
    +
    for (var i = 0; i < 5; i++) {
       // Will execute 5 times
     }
     

    JavaScript also contains two other prominent for loops: for...of

    -
    for (let value of array) {
    +
    for (let value of array) {
       // do something with value
     }
     

    and for...in:

    -
    for (let property in object) {
    +
    for (let property in object) {
       // do something with object property
     }
     

    The && and || operators use short-circuit logic, which means whether they will execute their second operand is dependent on the first. This is useful for checking for null objects before accessing their attributes:

    -
    var name = o && o.getName();
    +
    var name = o && o.getName();
     

    Or for caching values (when falsy values are invalid):

    -
    var name = cachedName || (cachedName = getName());
    +
    var name = cachedName || (cachedName = getName());
     

    JavaScript has a ternary operator for conditional expressions:

    -
    var allowed = (age > 18) ? 'yes' : 'no';
    +
    var allowed = (age > 18) ? 'yes' : 'no';
     

    The switch statement can be used for multiple branches based on a number or string:

    -
    switch (action) {
    +
    switch (action) {
       case 'draw':
         drawIt();
         break;
    @@ -344,7 +344,7 @@ 

    Control structures

    If you don't add a break statement, execution will "fall through" to the next level. This is very rarely what you want — in fact it's worth specifically labeling deliberate fallthrough with a comment if you really meant it to aid debugging:

    -
    switch (a) {
    +
    switch (a) {
       case 1: // fallthrough
       case 2:
         eatIt();
    @@ -356,7 +356,7 @@ 

    Control structures

    The default clause is optional. You can have expressions in both the switch part and the cases if you like; comparisons take place between the two using the === operator:

    -
    switch (1 + 3) {
    +
    switch (1 + 3) {
       case 2 + 2:
         yay();
         break;
    @@ -383,19 +383,19 @@ 

    Objects

    There are two basic ways to create an empty object:

    -
    var obj = new Object();
    +
    var obj = new Object();
     

    And:

    -
    var obj = {};
    +
    var obj = {};
     

    These are semantically equivalent; the second is called object literal syntax and is more convenient. This syntax is also the core of JSON format and should be preferred at all times.

    Object literal syntax can be used to initialize an object in its entirety:

    -
    var obj = {
    +
    var obj = {
       name: 'Carrot',
       _for: 'Max', // 'for' is a reserved word, use '_for' instead.
       details: {
    @@ -407,13 +407,13 @@ 

    Objects

    Attribute access can be chained together:

    -
    obj.details.color; // orange
    +
    obj.details.color; // orange
     obj['details']['size']; // 12
     

    The following example creates an object prototype(Person) and an instance of that prototype(you).

    -
    function Person(name, age) {
    +
    function Person(name, age) {
       this.name = name;
       this.age = age;
     }
    @@ -426,14 +426,14 @@ 

    Objects

    Once created, an object's properties can again be accessed in one of two ways:

    -
    // dot notation
    +
    // dot notation
     obj.name = 'Simon';
     var name = obj.name;
     

    And...

    -
    // bracket notation
    +
    // bracket notation
     obj['name'] = 'Simon';
     var name = obj['name'];
     // can use a variable to define a key
    @@ -443,7 +443,7 @@ 

    Objects

    These are also semantically equivalent. The second method has the advantage that the name of the property is provided as a string, which means it can be calculated at run-time. However, using this method prevents some JavaScript engine and minifier optimizations being applied. It can also be used to set and get properties with names that are reserved words:

    -
    obj.for = 'Simon'; // Syntax error, because 'for' is a reserved word
    +
    obj.for = 'Simon'; // Syntax error, because 'for' is a reserved word
     obj['for'] = 'Simon'; // works fine
     
    @@ -463,7 +463,7 @@

    Arrays

    One way of creating arrays is as follows:

    -
    var a = new Array();
    +
    var a = new Array();
     a[0] = 'dog';
     a[1] = 'cat';
     a[2] = 'hen';
    @@ -472,13 +472,13 @@ 

    Arrays

    A more convenient notation is to use an array literal:

    -
    var a = ['dog', 'cat', 'hen'];
    +
    var a = ['dog', 'cat', 'hen'];
     a.length; // 3
     

    Note that array.length isn't necessarily the number of items in the array. Consider the following:

    -
    var a = ['dog', 'cat', 'hen'];
    +
    var a = ['dog', 'cat', 'hen'];
     a[100] = 'fox';
     a.length; // 101
     
    @@ -487,19 +487,19 @@

    Arrays

    If you query a non-existent array index, you'll get a value of undefined in return:

    -
    typeof a[90]; // undefined
    +
    typeof a[90]; // undefined
     

    If you take the above about [] and length into account, you can iterate over an array using the following for loop:

    -
    for (var i = 0; i < a.length; i++) {
    +
    for (var i = 0; i < a.length; i++) {
       // Do something with a[i]
     }
     

    ES2015 introduced the more concise for...of loop for iterable objects such as arrays:

    -
    for (const currentValue of a) {
    +
    for (const currentValue of a) {
       // Do something with currentValue
     }
    @@ -507,14 +507,14 @@

    Arrays

    Another way of iterating over an array that was added with ECMAScript 5 is forEach():

    -
    ['dog', 'cat', 'hen'].forEach(function(currentValue, index, array) {
    +
    ['dog', 'cat', 'hen'].forEach(function(currentValue, index, array) {
       // Do something with currentValue or array[index]
     });
     

    If you want to append an item to an array do it like this:

    -
    a.push(item);
    +
    a.push(item);

    Arrays come with a number of methods. See also the full documentation for array methods.

    @@ -581,7 +581,7 @@

    Functions

    Along with objects, functions are the core component in understanding JavaScript. The most basic function couldn't be much simpler:

    -
    function add(x, y) {
    +
    function add(x, y) {
       var total = x + y;
       return total;
     }
    @@ -591,19 +591,19 @@ 

    Functions

    The named parameters turn out to be more like guidelines than anything else. You can call a function without passing the parameters it expects, in which case they will be set to undefined.

    -
    add(); // NaN
    +
    add(); // NaN
     // You can't perform addition on undefined
     

    You can also pass in more arguments than the function is expecting:

    -
    add(2, 3, 4); // 5
    +
    add(2, 3, 4); // 5
     // added the first two; 4 was ignored
     

    That may seem a little silly, but functions have access to an additional variable inside their body called arguments, which is an array-like object holding all of the values passed to the function. Let's re-write the add function to take as many values as we want:

    -
    function add() {
    +
    function add() {
       var sum = 0;
       for (var i = 0, j = arguments.length; i < j; i++) {
         sum += arguments[i];
    @@ -616,7 +616,7 @@ 

    Functions

    That's really not any more useful than writing 2 + 3 + 4 + 5 though. Let's create an averaging function:

    -
    function avg() {
    +
    function avg() {
       var sum = 0;
       for (var i = 0, j = arguments.length; i < j; i++) {
         sum += arguments[i];
    @@ -629,7 +629,7 @@ 

    Functions

    This is pretty useful, but it does seem a little verbose. To reduce this code a bit more we can look at substituting the use of the arguments array through Rest parameter syntax. In this way, we can pass in any number of arguments into the function while keeping our code minimal. The rest parameter operator is used in function parameter lists with the format: ...variable and it will include within that variable the entire list of uncaptured arguments that the function was called with. We will also replace the for loop with a for...of loop to return the values within our variable.

    -
    function avg(...args) {
    +
    function avg(...args) {
       var sum = 0;
       for (let value of args) {
         sum += value;
    @@ -644,7 +644,7 @@ 

    Functions


    It is important to note that wherever the rest parameter operator is placed in a function declaration it will store all arguments after its declaration, but not before. i.e. function avg(firstValue, ...args) will store the first value passed into the function in the firstValue variable and the remaining arguments in args. That's another useful language feature but it does lead us to a new problem. The avg() function takes a comma-separated list of arguments — but what if you want to find the average of an array? You could just rewrite the function as follows: -
    function avgArray(arr) {
    +
    function avgArray(arr) {
       var sum = 0;
       for (var i = 0, j = arr.length; i < j; i++) {
         sum += arr[i];
    @@ -657,7 +657,7 @@ 

    Functions

    But it would be nice to be able to reuse the function that we've already created. Luckily, JavaScript lets you call a function with an arbitrary array of arguments, using the {{jsxref("Function.apply", "apply()")}} method of any function object.

    -
    avg.apply(null, [2, 3, 4, 5]); // 3.5
    +
    avg.apply(null, [2, 3, 4, 5]); // 3.5
     

    The second argument to apply() is the array to use as arguments; the first will be discussed later on. This emphasizes the fact that functions are objects too.

    @@ -670,7 +670,7 @@

    Functions

    JavaScript lets you create anonymous functions.

    -
    var avg = function() {
    +
    var avg = function() {
       var sum = 0;
       for (var i = 0, j = arguments.length; i < j; i++) {
         sum += arguments[i];
    @@ -681,7 +681,7 @@ 

    Functions

    This is semantically equivalent to the function avg() form. It's extremely powerful, as it lets you put a full function definition anywhere that you would normally put an expression. This enables all sorts of clever tricks. Here's a way of "hiding" some local variables — like block scope in C:

    -
    var a = 1;
    +
    var a = 1;
     var b = 2;
     
     (function() {
    @@ -695,7 +695,7 @@ 

    Functions

    JavaScript allows you to call functions recursively. This is particularly useful for dealing with tree structures, such as those found in the browser DOM.

    -
    function countChars(elm) {
    +
    function countChars(elm) {
       if (elm.nodeType == 3) { // TEXT_NODE
         return elm.nodeValue.length;
       }
    @@ -709,7 +709,7 @@ 

    Functions

    This highlights a potential problem with anonymous functions: how do you call them recursively if they don't have a name? JavaScript lets you name function expressions for this. You can use named IIFEs (Immediately Invoked Function Expressions) as shown below:

    -
    var charsInBody = (function counter(elm) {
    +
    var charsInBody = (function counter(elm) {
       if (elm.nodeType == 3) { // TEXT_NODE
         return elm.nodeValue.length;
       }
    @@ -731,7 +731,7 @@ 

    Custom objects

    In classic Object Oriented Programming, objects are collections of data and methods that operate on that data. JavaScript is a prototype-based language that contains no class statement, as you'd find in C++ or Java (this is sometimes confusing for programmers accustomed to languages with a class statement). Instead, JavaScript uses functions as classes. Let's consider a person object with first and last name fields. There are two ways in which the name might be displayed: as "first last" or as "last, first". Using the functions and objects that we've discussed previously, we could display the data like this:

    -
    function makePerson(first, last) {
    +
    function makePerson(first, last) {
       return {
         first: first,
         last: last
    @@ -751,7 +751,7 @@ 

    Custom objects

    This works, but it's pretty ugly. You end up with dozens of functions in your global namespace. What we really need is a way to attach a function to an object. Since functions are objects, this is easy:

    -
    function makePerson(first, last) {
    +
    function makePerson(first, last) {
       return {
         first: first,
         last: last,
    @@ -773,7 +773,7 @@ 

    Custom objects

    Note that this is a frequent cause of mistakes. For example:

    -
    var s = makePerson('Simon', 'Willison');
    +
    var s = makePerson('Simon', 'Willison');
     var fullName = s.fullName;
     fullName(); // undefined undefined
     
    @@ -782,7 +782,7 @@

    Custom objects

    We can take advantage of the this keyword to improve our makePerson function:

    -
    function Person(first, last) {
    +
    function Person(first, last) {
       this.first = first;
       this.last = last;
       this.fullName = function() {
    @@ -801,7 +801,7 @@ 

    Custom objects

    Our person objects are getting better, but there are still some ugly edges to them. Every time we create a person object we are creating two brand new function objects within it — wouldn't it be better if this code was shared?

    -
    function personFullName() {
    +
    function personFullName() {
       return this.first + ' ' + this.last;
     }
     function personFullNameReversed() {
    @@ -817,7 +817,7 @@ 

    Custom objects

    That's better: we are creating the method functions only once, and assigning references to them inside the constructor. Can we do any better than that? The answer is yes:

    -
    function Person(first, last) {
    +
    function Person(first, last) {
       this.first = first;
       this.last = last;
     }
    @@ -833,7 +833,7 @@ 

    Custom objects

    This is an incredibly powerful tool. JavaScript lets you modify something's prototype at any time in your program, which means you can add extra methods to existing objects at runtime:

    -
    var s = new Person('Simon', 'Willison');
    +
    var s = new Person('Simon', 'Willison');
     s.firstNameCaps(); // TypeError on line 1: s.firstNameCaps is not a function
     
     Person.prototype.firstNameCaps = function() {
    @@ -844,7 +844,7 @@ 

    Custom objects

    Interestingly, you can also add things to the prototype of built-in JavaScript objects. Let's add a method to String that returns that string in reverse:

    -
    var s = 'Simon';
    +
    var s = 'Simon';
     s.reversed(); // TypeError on line 1: s.reversed is not a function
     
     String.prototype.reversed = function() {
    @@ -860,12 +860,12 @@ 

    Custom objects

    Our new method even works on string literals!

    -
    'This can now be reversed'.reversed(); // desrever eb won nac sihT
    +
    'This can now be reversed'.reversed(); // desrever eb won nac sihT
     

    As mentioned before, the prototype forms part of a chain. The root of that chain is Object.prototype, whose methods include toString() — it is this method that is called when you try to represent an object as a string. This is useful for debugging our Person objects:

    -
    var s = new Person('Simon', 'Willison');
    +
    var s = new Person('Simon', 'Willison');
     s.toString(); // [object Object]
     
     Person.prototype.toString = function() {
    @@ -877,7 +877,7 @@ 

    Custom objects

    Remember how avg.apply() had a null first argument? We can revisit that now. The first argument to apply() is the object that should be treated as 'this'. For example, here's a trivial implementation of new:

    -
    function trivialNew(constructor, ...args) {
    +
    function trivialNew(constructor, ...args) {
       var o = {}; // Create an object
       constructor.apply(o, args);
       return o;
    @@ -888,15 +888,15 @@ 

    Custom objects

    Calling

    -
    var bill = trivialNew(Person, 'William', 'Orange');
    +
    var bill = trivialNew(Person, 'William', 'Orange');

    is therefore almost equivalent to

    -
    var bill = new Person('William', 'Orange');
    +
    var bill = new Person('William', 'Orange');

    apply() has a sister function named call, which again lets you set this but takes an expanded argument list as opposed to an array.

    -
    function lastNameCaps() {
    +
    function lastNameCaps() {
       return this.last.toUpperCase();
     }
     var s = new Person('Simon', 'Willison');
    @@ -910,7 +910,7 @@ 

    Inner functions

    JavaScript function declarations are allowed inside other functions. We've seen this once before, with an earlier makePerson() function. An important detail of nested functions in JavaScript is that they can access variables in their parent function's scope:

    -
    function parentFunc() {
    +
    function parentFunc() {
       var a = 1;
     
       function nestedFunc() {
    @@ -929,7 +929,7 @@ 

    Closures

    This leads us to one of the most powerful abstractions that JavaScript has to offer — but also the most potentially confusing. What does this do?

    -
    function makeAdder(a) {
    +
    function makeAdder(a) {
       return function(b) {
         return a + b;
       };
    @@ -944,7 +944,7 @@ 

    Closures

    What's happening here is pretty much the same as was happening with the inner functions earlier on: a function defined inside another function has access to the outer function's variables. The only difference here is that the outer function has returned, and hence common sense would seem to dictate that its local variables no longer exist. But they do still exist — otherwise, the adder functions would be unable to work. What's more, there are two different "copies" of makeAdder()'s local variables — one in which a is 5 and the other one where a is 20. So the result of that function calls is as follows:

    -
    add5(6); // returns 11
    +
    add5(6); // returns 11
     add20(7); // returns 27
     
    diff --git a/files/en-us/web/javascript/closures/index.html b/files/en-us/web/javascript/closures/index.html index 4c5691a3810cb8e..9da4b52045d683f 100644 --- a/files/en-us/web/javascript/closures/index.html +++ b/files/en-us/web/javascript/closures/index.html @@ -17,7 +17,7 @@

    Lexical scoping

    Consider the following example code:

    -
    function init() {
    +
    function init() {
       var name = 'Mozilla'; // name is a local variable created by init
       function displayName() { // displayName() is the inner function, a closure
         alert(name); // use variable declared in the parent function
    @@ -34,7 +34,7 @@ 

    Closure

    Consider the following code example:

    -
    function makeFunc() {
    +
    function makeFunc() {
       var name = 'Mozilla';
       function displayName() {
         alert(name);
    @@ -54,7 +54,7 @@ 

    Closure

    Here's a slightly more interesting example—a makeAdder function:

    -
    function makeAdder(x) {
    +
    function makeAdder(x) {
       return function(y) {
         return x + y;
       };
    @@ -83,7 +83,7 @@ 

    Practical closures

    For instance, suppose we want to add buttons to a page to adjust the text size. One way of doing this is to specify the font-size of the body element (in pixels), and then set the size of the other elements on the page (such as headers) using the relative em unit:

    -
    body {
    +
    body {
       font-family: Helvetica, Arial, sans-serif;
       font-size: 12px;
     }
    @@ -101,7 +101,7 @@ 

    Practical closures

    Here's the JavaScript:

    -
    function makeSizer(size) {
    +
    function makeSizer(size) {
       return function() {
         document.body.style.fontSize = size + 'px';
       };
    @@ -114,12 +114,12 @@ 

    Practical closures

    size12, size14, and size16 are now functions that resize the body text to 12, 14, and 16 pixels, respectively. You can attach them to buttons (in this case hyperlinks) as demonstrated in the following code example.

    -
    document.getElementById('size-12').onclick = size12;
    +
    document.getElementById('size-12').onclick = size12;
     document.getElementById('size-14').onclick = size14;
     document.getElementById('size-16').onclick = size16;
     
    -
    <a href="#" id="size-12">12</a>
    +
    <a href="#" id="size-12">12</a>
     <a href="#" id="size-14">14</a>
     <a href="#" id="size-16">16</a>
     
    @@ -134,7 +134,7 @@

    Emulating private methods with

    The following code illustrates how to use closures to define public functions that can access private functions and variables. Note that these closures follow the Module Design Pattern.

    -
    var counter = (function() {
    +
    var counter = (function() {
       var privateCounter = 0;
       function changeBy(val) {
         privateCounter += val;
    @@ -171,7 +171,7 @@ 

    Emulating private methods with

    Those three public functions are closures that share the same lexical environment. Thanks to JavaScript's lexical scoping, they each have access to the privateCounter variable and the changeBy function.

    -
    var makeCounter = function() {
    +
    var makeCounter = function() {
       var privateCounter = 0;
       function changeBy(val) {
         privateCounter += val;
    @@ -223,7 +223,7 @@ 

    Closure Scope Chain

    A common mistake is not realizing that in the case where the outer function is itself a nested function, access to the outer function's scope includes the enclosing scope of the outer function—effectively creating a chain of function scopes. To demonstrate, consider the following example code.

    -
    // global scope
    +
    // global scope
     var e = 10;
     function sum(a){
       return function(b){
    @@ -268,13 +268,13 @@ 

    Creating closures in loops:

    Prior to the introduction of the let keyword in ECMAScript 2015, a common problem with closures occurred when you created them inside a loop. To demonstrate, consider the following example code.

    -
    <p id="help">Helpful notes will appear here</p>
    +
    <p id="help">Helpful notes will appear here</p>
     <p>E-mail: <input type="text" id="email" name="email"></p>
     <p>Name: <input type="text" id="name" name="name"></p>
     <p>Age: <input type="text" id="age" name="age"></p>
     
    -
    function showHelp(help) {
    +
    function showHelp(help) {
       document.getElementById('help').textContent = help;
     }
     
    @@ -306,7 +306,7 @@ 

    Creating closures in loops:

    One solution in this case is to use more closures: in particular, to use a function factory as described earlier:

    -
    function showHelp(help) {
    +
    function showHelp(help) {
       document.getElementById('help').textContent = help;
     }
     
    @@ -338,7 +338,7 @@ 

    Creating closures in loops:

    One other way to write the above using anonymous closures is:

    -
    function showHelp(help) {
    +
    function showHelp(help) {
       document.getElementById('help').textContent = help;
     }
     
    @@ -363,7 +363,7 @@ 

    Creating closures in loops:

    If you don't want to use more closures, you can use the let keyword introduced in ES2015 :

    -
    function showHelp(help) {
    +
    function showHelp(help) {
       document.getElementById('help').textContent = help;
     }
     
    @@ -388,7 +388,7 @@ 

    Creating closures in loops:

    Another alternative could be to use forEach() to iterate over the helpText array and attach a listener to each <input>, as shown:

    -
    function showHelp(help) {
    +
    function showHelp(help) {
       document.getElementById('help').textContent = help;
     }
     
    @@ -416,7 +416,7 @@ 

    Performance considerations

    Consider the following case:

    -
    function MyObject(name, message) {
    +
    function MyObject(name, message) {
       this.name = name.toString();
       this.message = message.toString();
       this.getName = function() {
    @@ -431,7 +431,7 @@ 

    Performance considerations

    Because the previous code does not take advantage of the benefits of using closures in this particular instance, we could instead rewrite it to avoid using closure as follows:

    -
    function MyObject(name, message) {
    +
    function MyObject(name, message) {
       this.name = name.toString();
       this.message = message.toString();
     }
    @@ -447,7 +447,7 @@ 

    Performance considerations

    However, redefining the prototype is not recommended. The following example instead appends to the existing prototype:

    -
    function MyObject(name, message) {
    +
    function MyObject(name, message) {
       this.name = name.toString();
       this.message = message.toString();
     }
    diff --git a/files/en-us/web/javascript/data_structures/index.html b/files/en-us/web/javascript/data_structures/index.html
    index c30f8722842da17..c226bd759fd8bb2 100644
    --- a/files/en-us/web/javascript/data_structures/index.html
    +++ b/files/en-us/web/javascript/data_structures/index.html
    @@ -15,7 +15,7 @@ 

    Dynamic typing

    JavaScript is a loosely typed and dynamic language. Variables in JavaScript are not 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
    +
    let foo = 42;    // foo is now a number
     foo     = 'bar'; // foo is now a string
     foo     = true;  // foo is now a boolean
     
    @@ -87,7 +87,7 @@

    Number type

    In the praxis, this has almost no impact. For example, +0 === -0 is true. However, you are able to notice this when you divide by zero:

    -
    > 42 / +0
    +
    > 42 / +0
     Infinity
     > 42 / -0
     -Infinity
    @@ -111,7 +111,7 @@ 

    BigInt type

    This example demonstrates, where incrementing the {{jsxref("Number.MAX_SAFE_INTEGER")}} returns the expected result:

    -
    > const x = 2n ** 53n;
    +
    > const x = 2n ** 53n;
     9007199254740992n
     > const y = x + 1n;
     9007199254740993n
    diff --git a/files/en-us/web/javascript/equality_comparisons_and_sameness/index.html b/files/en-us/web/javascript/equality_comparisons_and_sameness/index.html
    index c95a35034548b93..deb72033bc02848 100644
    --- a/files/en-us/web/javascript/equality_comparisons_and_sameness/index.html
    +++ b/files/en-us/web/javascript/equality_comparisons_and_sameness/index.html
    @@ -46,7 +46,7 @@ 

    Strict equality using ===

    Strict equality compares two values for equality. Neither value is implicitly converted to some other value before being compared. If the values have different types, the values are considered unequal. If the values have the same type, are not numbers, and have the same value, they're considered equal. Finally, if both values are numbers, they're considered equal if they're both not NaN and are the same value, or if one is +0 and one is -0.

    -
    var num = 0;
    +
    var num = 0;
     var obj = new String('0');
     var str = '0';
     
    @@ -150,7 +150,7 @@ 

    Loose equality using ==

    Traditionally, and according to ECMAScript, all objects are loosely unequal to undefined and null. But most browsers permit a very narrow class of objects (specifically, the document.all object for any page), in some contexts, to act as if they emulate the value undefined. Loose equality is one such context: null == A and undefined == A evaluate to true if, and only if, A is an object that emulates undefined. In all other cases an object is never loosely equal to undefined or null.

    -
    var num = 0;
    +
    var num = 0;
     var obj = new String('0');
     var str = '0';
     
    @@ -174,7 +174,7 @@ 

    Same-value equality

    Same-value equality addresses a final use case: determining whether two values are functionally identical in all contexts. (This use case demonstrates an instance of the Liskov substitution principle.) One instance occurs when an attempt is made to mutate an immutable property:

    -
    // Add an immutable NEGATIVE_ZERO property to the Number constructor.
    +
    // Add an immutable NEGATIVE_ZERO property to the Number constructor.
     Object.defineProperty(Number, 'NEGATIVE_ZERO',
                           { value: -0, writable: false, configurable: false, enumerable: false });
     
    @@ -436,7 +436,7 @@ 

    When to use {{jsxref("
    - (unary negation)
    -
    let stoppingForce = obj.mass * -obj.velocity;
    +
    let stoppingForce = obj.mass * -obj.velocity;

    If obj.velocity is 0 (or computes to 0), a -0 is introduced at that place and propagates out into stoppingForce.

    @@ -467,7 +467,7 @@

    Caveat: {{jsxref("Object.is")}} and NaN<

    The {{jsxref("Object.is")}} specification treats all instances of {{jsxref("NaN")}} as the same object. However, since typed arrays are available, we can have distinct instances, which don't behave identically in all contexts. For example:

    -
    var f2b = x => new Uint8Array(new Float64Array([x]).buffer);
    +
    var f2b = x => new Uint8Array(new Float64Array([x]).buffer);
     var b2f = x => new Float64Array(x.buffer)[0];
     var n = f2b(NaN);
     n[0] = 1;
    diff --git a/files/en-us/web/javascript/guide/control_flow_and_error_handling/index.html b/files/en-us/web/javascript/guide/control_flow_and_error_handling/index.html
    index ea8f307db3254f4..53a7f272d8a0905 100644
    --- a/files/en-us/web/javascript/guide/control_flow_and_error_handling/index.html
    +++ b/files/en-us/web/javascript/guide/control_flow_and_error_handling/index.html
    @@ -34,7 +34,7 @@ 

    Block statement

    The most basic statement is a block statement, which is used to group statements. The block is delimited by a pair of curly brackets:

    -
    {
    +
    {
       statement_1;
       statement_2;
       ⋮
    @@ -95,7 +95,7 @@ 

    if...else statement

    An if statement looks like this:

    -
    if (condition) {
    +
    if (condition) {
       statement_1;
     } else {
       statement_2;
    @@ -115,7 +115,7 @@ 

    if...else statement

    You can also compound the statements using else if to have multiple conditions tested in sequence, as follows:

    -
    if (condition_1) {
    +
    if (condition_1) {
       statement_1;
     } else if (condition_2) {
       statement_2;
    @@ -135,7 +135,7 @@ 

    Best practice

    In general, it's good practice to always use block statements—especially when nesting if statements:

    -
    if (condition) {
    +
    if (condition) {
       statement_1_runs_if_condition_is_true;
       statement_2_runs_if_condition_is_true;
     } else {
    @@ -219,7 +219,7 @@ 

    switch statement

    A switch statement looks like this:

    -
    switch (expression) {
    +
    switch (expression) {
       case label_1:
         statements_1
         [break;]
    @@ -327,7 +327,7 @@ 

    throw statement

    Use the throw statement to throw an exception. A throw statement specifies the value to be thrown:

    -
    throw expression;
    +
    throw expression;
     

    You may throw any expression, not just expressions of a specific type. The following @@ -410,7 +410,7 @@

    The catch block

    You can use a catch block to handle all exceptions that may be generated in the try block.

    -
    catch (catchID) {
    +
    catch (catchID) {
       statements
     }
     
    diff --git a/files/en-us/web/javascript/guide/expressions_and_operators/index.html b/files/en-us/web/javascript/guide/expressions_and_operators/index.html index e5e77750f3ce848..145d64589af016a 100644 --- a/files/en-us/web/javascript/guide/expressions_and_operators/index.html +++ b/files/en-us/web/javascript/guide/expressions_and_operators/index.html @@ -41,19 +41,19 @@

    Operators

    ternary operator, the conditional operator. A binary operator requires two operands, one before the operator and one after the operator:

    -
    operand1 operator operand2
    +
    operand1 operator operand2
     

    For example, 3+4 or x*y.

    A unary operator requires a single operand, either before or after the operator:

    -
    operator operand
    +
    operator operand
     

    or

    -
    operand operator
    +
    operand operator
     

    For example, x++ or ++x.

    @@ -198,7 +198,7 @@

    Return value and chaining

    Like most expressions, assignments like x = y have a return value. It can be retrieved by e.g. assigning the expression or logging it:

    -
    const z = (x = y); // Or equivalently: const z = x = y;
    +
    const z = (x = y); // Or equivalently: const z = x = y;
     
     console.log(z); // Log the return value of the assignment x = y.
     console.log(x = y); // Or log the return value directly.
    @@ -235,7 +235,7 @@ 

    Destructuring

    data from arrays or objects using a syntax that mirrors the construction of array and object literals.

    -
    var foo = ['one', 'two', 'three'];
    +
    var foo = ['one', 'two', 'three'];
     
     // without destructuring
     var one   = foo[0];
    @@ -258,7 +258,7 @@ 

    Comparison operators

    not attempt to convert the operands to compatible types before checking equality. The following table describes the comparison operators in terms of this sample code:

    -
    var var1 = 3;
    +
    var var1 = 3;
     var var2 = 4;
     
    @@ -363,7 +363,7 @@

    Arithmetic operators

    other programming languages when used with floating point numbers (in particular, note that division by zero produces {{jsxref("Infinity")}}). For example:

    -
    1 / 2; // 0.5
    +
    1 / 2; // 0.5
     1 / 2 == 1.0 / 2.0; // this is true
     
    @@ -521,7 +521,7 @@

    Bitwise logical operators

    bits (zeros and ones). Numbers with more than 32 bits get their most significant bits discarded. For example, the following integer with more than 32 bits will be converted to a 32 bit integer: -
    Before: 1110 0110 1111 1010 0000 0000 0000 0110 0000 0000 0001
    +    
    Before: 1110 0110 1111 1010 0000 0000 0000 0110 0000 0000 0001
     After:               1010 0000 0000 0000 0110 0000 0000 0001
  • Each bit in the first operand is paired with the corresponding bit in the second @@ -687,7 +687,7 @@

    Logical operators

    The following code shows examples of the && (logical AND) operator.

    -
    var a1 =  true && true;     // t && t returns true
    +
    var a1 =  true && true;     // t && t returns true
     var a2 =  true && false;    // t && f returns false
     var a3 = false && true;     // f && t returns false
     var a4 = false && (3 == 4); // f && f returns false
    @@ -698,7 +698,7 @@ 

    Logical operators

    The following code shows examples of the || (logical OR) operator.

    -
    var o1 =  true || true;     // t || t returns true
    +
    var o1 =  true || true;     // t || t returns true
     var o2 = false || true;     // f || t returns true
     var o3 =  true || false;    // t || f returns true
     var o4 = false || (3 == 4); // f || f returns false
    @@ -709,7 +709,7 @@ 

    Logical operators

    The following code shows examples of the ! (logical NOT) operator.

    -
    var n1 = !true;  // !t returns false
    +
    var n1 = !true;  // !t returns false
     var n2 = !false; // !f returns true
     var n3 = !'Cat'; // !t returns false
     
    @@ -750,13 +750,13 @@

    String operators

    For example,

    console.log('my ' + 'string'); // console logs the string "my string".
    + class="brush: js">console.log('my ' + 'string'); // console logs the string "my string".

    The shorthand assignment operator += can also be used to concatenate strings.

    For example,

    -
    var mystring = 'alpha';
    +
    var mystring = 'alpha';
     mystring += 'bet'; // evaluates to "alphabet" and assigns this value to mystring.

    Conditional (ternary) operator

    @@ -766,7 +766,7 @@

    Conditional (ternary) operator

    operator is the only JavaScript operator that takes three operands. The operator can have one of two values based on a condition. The syntax is:

    -
    condition ? val1 : val2
    +
    condition ? val1 : val2
     

    If condition is true, the operator has the value of val1. @@ -775,7 +775,7 @@

    Conditional (ternary) operator

    For example,

    -
    var status = (age >= 18) ? 'adult' : 'minor';
    +
    var status = (age >= 18) ? 'adult' : 'minor';
     

    This statement assigns the value "adult" to the variable status if @@ -795,7 +795,7 @@

    Comma operator

    following code uses the comma operator to update two variables at once. The code prints the values of the diagonal elements in the array:

    -
    var x = [0,1,2,3,4,5,6,7,8,9]
    +
    var x = [0,1,2,3,4,5,6,7,8,9]
     var a = [x, x, x, x, x];
     
     for (var i = 0, j = 9; i <= j; i++, j--)
    @@ -813,7 +813,7 @@ 

    delete

    delete operator deletes an object's property. The syntax is:

    -
    delete object.property;
    +
    delete object.property;
     delete object[propertyKey];
     delete objectName[index];
     delete property; // legal only within a with statement
    @@ -833,7 +833,7 @@ 

    delete

    delete operator returns true if the operation is possible; it returns false if the operation is not possible.

    -
    x = 42; // implicitly creates window.x
    +
    x = 42; // implicitly creates window.x
     var y = 43;
     var myobj = {h: 4}; // create object with property h
     
    @@ -859,7 +859,7 @@ 

    typeof

    The typeof operator is used in either of the following ways:

    -
    typeof operand
    +
    typeof operand
     typeof (operand)
     
    @@ -869,7 +869,7 @@

    typeof

    Suppose you define the following variables:

    -
    var myFun = new Function('5 + 2');
    +
    var myFun = new Function('5 + 2');
     var shape = 'round';
     var size = 1;
     var foo = ['Apple', 'Mango', 'Orange'];
    @@ -878,7 +878,7 @@ 

    typeof

    The typeof operator returns the following results for these variables:

    -
    typeof myFun;       // returns "function"
    +
    typeof myFun;       // returns "function"
     typeof shape;       // returns "string"
     typeof size;        // returns "number"
     typeof foo;         // returns "object"
    @@ -889,21 +889,21 @@ 

    typeof

    For the keywords true and null, the typeof operator returns the following results:

    -
    typeof true; // returns "boolean"
    +
    typeof true; // returns "boolean"
     typeof null; // returns "object"
     

    For a number or string, the typeof operator returns the following results:

    -
    typeof 62;            // returns "number"
    +
    typeof 62;            // returns "number"
     typeof 'Hello world'; // returns "string"
     

    For property values, the typeof operator returns the type of value the property contains:

    -
    typeof document.lastModified; // returns "string"
    +
    typeof document.lastModified; // returns "string"
     typeof window.length;         // returns "number"
     typeof Math.LN2;              // returns "number"
     
    @@ -911,7 +911,7 @@

    typeof

    For methods and functions, the typeof operator returns results as follows:

    -
    typeof blur;        // returns "function"
    +
    typeof blur;        // returns "function"
     typeof eval;        // returns "function"
     typeof parseInt;    // returns "function"
     typeof shape.split; // returns "function"
    @@ -920,7 +920,7 @@ 

    typeof

    For predefined objects, the typeof operator returns results as follows:

    -
    typeof Date;     // returns "function"
    +
    typeof Date;     // returns "function"
     typeof Function; // returns "function"
     typeof Math;     // returns "object"
     typeof Option;   // returns "function"
    @@ -932,7 +932,7 @@ 

    void

    The void operator is used in either of the following ways:

    -
    void (expression)
    +
    void (expression)
     void expression
     
    @@ -952,7 +952,7 @@

    in

    operator returns true if the specified property is in the specified object. The syntax is:

    -
    propNameOrNumber in objectName
    +
    propNameOrNumber in objectName
     

    where propNameOrNumber is a string, numeric, or symbol expression @@ -961,7 +961,7 @@

    in

    The following examples show some uses of the in operator.

    -
    // Arrays
    +
    // Arrays
     var trees = ['redwood', 'bay', 'cedar', 'oak', 'maple'];
     0 in trees;        // returns true
     3 in trees;        // returns true
    @@ -988,7 +988,7 @@ 

    instanceof

    operator returns true if the specified object is of the specified object type. The syntax is:

    -
    objectName instanceof objectType
    +
    objectName instanceof objectType
     

    where objectName is the name of the object to compare to @@ -1003,7 +1003,7 @@

    instanceof

    theDay is a Date object. Because theDay is a Date object, the statements in the if statement execute.

    -
    var theDay = new Date(1995, 12, 17);
    +
    var theDay = new Date(1995, 12, 17);
     if (theDay instanceof Date) {
       // statements to execute
     }
    @@ -1140,14 +1140,14 @@ 

    this

    the calling object in a method. Use this either with the dot or the bracket notation:

    -
    this['propertyName']
    +
    this['propertyName']
     this.propertyName
     

    Suppose a function called validate validates an object's value property, given the object and the high and low values:

    -
    function validate(obj, lowval, hival) {
    +
    function validate(obj, lowval, hival) {
       if ((obj.value < lowval) || (obj.value > hival))
         console.log('Invalid Value!');
     }
    @@ -1157,7 +1157,7 @@ 

    this

    handler, using this to pass it to the form element, as in the following example:

    -
    <p>Enter a number between 18 and 99:</p>
    +
    <p>Enter a number between 18 and 99:</p>
     <input type="text" name="age" size=3 onChange="validate(this, 18, 99);">
     
    @@ -1167,7 +1167,7 @@

    Grouping operator

    expressions. For example, you can override multiplication and division first, then addition and subtraction to evaluate addition first.

    -
    var a = 1;
    +
    var a = 1;
     var b = 2;
     var c = 3;
     
    @@ -1195,7 +1195,7 @@ 

    new

    operator to create an instance of a user-defined object type or of one of the built-in object types. Use new as follows:

    -
    var objectName = new objectType([param1, param2, ..., paramN]);
    +
    var objectName = new objectType([param1, param2, ..., paramN]);
     

    super

    @@ -1205,7 +1205,7 @@

    super

    href="/en-US/docs/Web/JavaScript/Reference/Classes">classes to call the parent constructor, for example.

    -
    super([arguments]); // calls the parent constructor.
    +
    super([arguments]); // calls the parent constructor.
     super.functionOnParent([arguments]);
     
    diff --git a/files/en-us/web/javascript/guide/functions/index.html b/files/en-us/web/javascript/guide/functions/index.html index 69b046ad8adf8ae..92792946496e804 100644 --- a/files/en-us/web/javascript/guide/functions/index.html +++ b/files/en-us/web/javascript/guide/functions/index.html @@ -28,21 +28,21 @@

    Function declarations

    For example, the following code defines a simple function named square:

    -
    function square(number) {
    +
    function square(number) {
       return number * number;
     }
     

    The function square takes one parameter, called number. The function consists of one statement that says to return the parameter of the function (that is, number) multiplied by itself. The statement return specifies the value returned by the function:

    -
    return number * number;
    +
    return number * number;
     

    Primitive parameters (such as a number) are passed to functions by value; the value is passed to the function, but if the function changes the value of the parameter, this change is not reflected globally or in the calling function.

    If you pass an object (i.e. a non-primitive value, such as {{jsxref("Array")}} or a user-defined object) as a parameter and the function changes the object's properties, that change is visible outside the function, as shown in the following example:

    -
    function myFunc(theObject) {
    +
    function myFunc(theObject) {
       theObject.make = 'Toyota';
     }
     
    @@ -62,19 +62,19 @@ 

    Function expressions

    Such a function can be anonymous; it does not have to have a name. For example, the function square could have been defined as:

    -
    const square = function(number) { return number * number }
    +
    const square = function(number) { return number * number }
     var x = square(4) // x gets the value 16

    However, a name can be provided with a function expression. Providing a name allows the function to refer to itself, and also makes it easier to identify the function in a debugger's stack traces:

    -
    const factorial = function fac(n) { return n < 2 ? 1 : n * fac(n - 1) }
    +
    const factorial = function fac(n) { return n < 2 ? 1 : n * fac(n - 1) }
     
     console.log(factorial(3))
     

    Function expressions are convenient when passing a function as an argument to another function. The following example shows a map function that should receive a function as first argument and an array as second argument. 

    -
    function map(f, a) {
    +
    function map(f, a) {
       let result = []; // Create a new Array
       let i; // Declare variable
       for (i = 0; i != a.length; i++)
    @@ -85,7 +85,7 @@ 

    Function expressions

    In the following code, the function receives a function defined by a function expression and executes it for every element of the array received as a second argument. 

    -
    function map(f, a) {
    +
    function map(f, a) {
       let result = []; // Create a new Array
       let i; // Declare variable
       for (i = 0; i != a.length; i++)
    @@ -103,7 +103,7 @@ 

    Function expressions

    In JavaScript, a function can be defined based on a condition. For example, the following function definition defines myFunc only if num equals 0:

    -
    var myFunc;
    +
    var myFunc;
     if (num === 0) {
       myFunc = function(theObject) {
         theObject.make = 'Toyota';
    @@ -120,14 +120,14 @@ 

    Calling functions

    Calling the function actually performs the specified actions with the indicated parameters. For example, if you define the function square, you could call it as follows:

    -
    square(5);
    +
    square(5);
     

    The preceding statement calls the function with an argument of 5. The function executes its statements and returns the value 25.

    Functions must be in scope when they are called, but the function declaration can be hoisted (appear below the call in the code), as in this example:

    -
    console.log(square(5));
    +
    console.log(square(5));
     /* ... */
     function square(n) { return n * n }
     
    @@ -139,7 +139,7 @@

    Calling functions

    This means that function hoisting only works with function declarations—not with function expressions.

    -
    console.log(square)    // square is hoisted with an initial value undefined.
    +
    console.log(square)    // square is hoisted with an initial value undefined.
     console.log(square(5)) // Uncaught TypeError: square is not a function
     const square = function(n) {
       return n * n;
    @@ -151,7 +151,7 @@ 

    Calling functions

    A function can call itself. For example, here is a function that computes factorials recursively:

    -
    function factorial(n) {
    +
    function factorial(n) {
       if ((n === 0) || (n === 1))
         return 1;
       else
    @@ -161,7 +161,7 @@ 

    Calling functions

    You could then compute the factorials of 1 through 5 as follows:

    -
    var a, b, c, d, e;
    +
    var a, b, c, d, e;
     a = factorial(1); // a gets the value 1
     b = factorial(2); // b gets the value 2
     c = factorial(3); // c gets the value 6
    @@ -179,7 +179,7 @@ 

    Function scope

    In other words, a function defined in the global scope can access all variables defined in the global scope. A function defined inside another function can also access all variables defined in its parent function, and any other variables to which the parent function has access.

    -
    // The following variables are defined in the global scope
    +
    // The following variables are defined in the global scope
     var num1 = 20,
         num2 = 3,
         name = 'Chamahk';
    @@ -220,7 +220,7 @@ 

    Recursion

    For example, consider the following function definition:

    -
    var foo = function bar() {
    +
    var foo = function bar() {
        // statements go here
     }
     
    @@ -237,7 +237,7 @@

    Recursion

    For example, the following loop...

    -
    var x = 0;
    +
    var x = 0;
     while (x < 10) { // "x < 10" is the loop condition
        // do stuff
        x++;
    @@ -246,7 +246,7 @@ 

    Recursion

    ...can be converted into a recursive function declaration, followed by a call to that function:

    -
    function loop(x) {
    +
    function loop(x) {
       if (x >= 10) // "x >= 10" is the exit condition (equivalent to "!(x < 10)")
         return;
       // do stuff
    @@ -257,7 +257,7 @@ 

    Recursion

    However, some algorithms cannot be simple iterative loops. For example, getting all the nodes of a tree structure (such as the DOM) is easier via recursion:

    -
    function walkTree(node) {
    +
    function walkTree(node) {
       if (node == null) //
         return;
       // do something with node
    @@ -273,7 +273,7 @@ 

    Recursion

    In fact, recursion itself uses a stack: the function stack. The stack-like behavior can be seen in the following example:

    -
    function foo(i) {
    +
    function foo(i) {
       if (i < 0)
         return;
       console.log('begin: ' + i);
    @@ -313,7 +313,7 @@ 

    Nested functions and closures

    The following example shows nested functions:

    -
    function addSquares(a, b) {
    +
    function addSquares(a, b) {
       function square(x) {
         return x * x;
       }
    @@ -326,7 +326,7 @@ 

    Nested functions and closures

    Since the inner function forms a closure, you can call the outer function and specify arguments for both the outer and inner function:

    -
    function outside(x) {
    +
    function outside(x) {
       function inside(y) {
         return x + y;
       }
    @@ -359,7 +359,7 @@ 

    Multiply-nested functions

    Consider the following example:

    -
    function A(x) {
    +
    function A(x) {
       function B(y) {
         function C(z) {
           console.log(x + y + z);
    @@ -387,7 +387,7 @@ 

    Name conflicts

    When two arguments or variables in the scopes of a closure have the same name, there is a name conflict. More nested scopes take precedence. So, the inner-most scope takes the highest precedence, while the outer-most scope takes the lowest. This is the scope chain. The first on the chain is the inner-most scope, and the last is the outer-most scope. Consider the following:

    -
    function outside() {
    +
    function outside() {
       var x = 5;
       function inside(x) {
         return x * 2;
    @@ -408,7 +408,7 @@ 

    Closures

    Also, since the inner function has access to the scope of the outer function, the variables and functions defined in the outer function will live longer than the duration of the outer function execution, if the inner function manages to survive beyond the life of the outer function. A closure is created when the inner function is somehow made available to any scope outside the outer function.

    -
    var pet = function(name) {   // The outer function defines a variable called "name"
    +
    var pet = function(name) {   // The outer function defines a variable called "name"
       var getName = function() {
         return name;             // The inner function has access to the "name" variable of the outer
                                  //function
    @@ -422,7 +422,7 @@ 

    Closures

    It can be much more complex than the code above. An object containing methods for manipulating the inner variables of the outer function can be returned.

    -
    var createPet = function(name) {
    +
    var createPet = function(name) {
       var sex;
     
       return {
    @@ -458,7 +458,7 @@ 

    Closures

    In the code above, the name variable of the outer function is accessible to the inner functions, and there is no other way to access the inner variables except through the inner functions. The inner variables of the inner functions act as safe stores for the outer arguments and variables. They hold "persistent" and "encapsulated" data for the inner functions to work with. The functions do not even have to be assigned to a variable, or have a name.

    -
    var getCode = (function() {
    +
    var getCode = (function() {
       var apiCode = '0]Eal(eh&2';    // A code we do not want outsiders to be able to modify...
     
       return function() {
    @@ -474,7 +474,7 @@ 

    Closures

    If an enclosed function defines a variable with the same name as a variable in the outer scope, then there is no way to refer to the variable in the outer scope again.  (The inner scope variable "overrides" the outer one, until the program exits the inner scope.)

    -
    var createPet = function(name) {  // The outer function defines a variable called "name".
    +
    var createPet = function(name) {  // The outer function defines a variable called "name".
       return {
         setName: function(name) {    // The enclosed function also defines a variable called "name".
           name = name;               // How do we access the "name" defined by the outer function?
    @@ -488,7 +488,7 @@ 

    Using the arguments object

    The arguments of a function are maintained in an array-like object. Within a function, you can address the arguments passed to it as follows:

    -
    arguments[i]
    +
    arguments[i]
     

    where i is the ordinal number of the argument, starting at 0. So, the first argument passed to a function would be arguments[0]. The total number of arguments is indicated by arguments.length.

    @@ -497,7 +497,7 @@

    Using the arguments object

    For example, consider a function that concatenates several strings. The only formal argument for the function is a string that specifies the characters that separate the items to concatenate. The function is defined as follows:

    -
    function myConcat(separator) {
    +
    function myConcat(separator) {
        var result = ''; // initialize list
        var i;
        // iterate through arguments
    @@ -510,7 +510,7 @@ 

    Using the arguments object

    You can pass any number of arguments to this function, and it concatenates each argument into a string "list":

    -
    // returns "red, orange, blue, "
    +
    // returns "red, orange, blue, "
     myConcat(', ', 'red', 'orange', 'blue');
     
     // returns "elephant; giraffe; lion; cheetah; "
    @@ -540,7 +540,7 @@ 

    Without default paramete

    In the following example, if no value is provided for b, its value would be undefined when evaluating a*b, and a call to multiply would normally have returned NaN. However, this is prevented by the second line in this example:

    -
    function multiply(a, b) {
    +
    function multiply(a, b) {
       b = typeof b !== 'undefined' ?  b : 1;
     
       return a * b;
    @@ -553,7 +553,7 @@ 

    With default parameters (p

    With default parameters, a manual check in the function body is no longer necessary. You can put 1 as the default value for b in the function head:

    -
    function multiply(a, b = 1) {
    +
    function multiply(a, b = 1) {
       return a * b;
     }
     
    @@ -567,7 +567,7 @@ 

    Rest parameters

    In the following example, the function multiply uses rest parameters to collect arguments from the second one to the end. The function then multiplies these by the first argument . 

    -
    function multiply(multiplier, ...theArgs) {
    +
    function multiply(multiplier, ...theArgs) {
       return theArgs.map(x => multiplier * x);
     }
     
    @@ -584,7 +584,7 @@ 

    Shorter functions

    In some functional patterns, shorter functions are welcome. Compare:

    -
    var a = [
    +
    var a = [
       'Hydrogen',
       'Helium',
       'Lithium',
    @@ -604,7 +604,7 @@ 

    No separate this

    Until arrow functions, every new function defined its own this value (a new object in the case of a constructor, undefined in strict mode function calls, the base object if the function is called as an "object method", etc.). This proved to be less than ideal with an object-oriented style of programming.

    -
    function Person() {
    +
    function Person() {
       // The Person() constructor defines `this` as itself.
       this.age = 0;
     
    @@ -620,7 +620,7 @@ 

    No separate this

    In ECMAScript 3/5, this issue was fixed by assigning the value in this to a variable that could be closed over.

    -
    function Person() {
    +
    function Person() {
       var self = this; // Some choose `that` instead of `self`.
                        // Choose one and be consistent.
       self.age = 0;
    @@ -636,7 +636,7 @@ 

    No separate this

    An arrow function does not have its own this; the this value of the enclosing execution context is used. Thus, in the following code, the this within the function that is passed to setInterval has the same value as this in the enclosing function:

    -
    function Person() {
    +
    function Person() {
       this.age = 0;
     
       setInterval(() => {
    diff --git a/files/en-us/web/javascript/guide/grammar_and_types/index.html b/files/en-us/web/javascript/guide/grammar_and_types/index.html
    index a1f6fbeccdc874b..fb3673de3ac27da 100644
    --- a/files/en-us/web/javascript/guide/grammar_and_types/index.html
    +++ b/files/en-us/web/javascript/guide/grammar_and_types/index.html
    @@ -16,7 +16,7 @@ 

    Basics

    JavaScript is case-sensitive and uses the Unicode character set. For example, the word Früh (which means "early" in German) could be used as a variable name.

    -
    let Früh = "foobar"
    +
    let Früh = "foobar"

    But, the variable früh is not the same as Früh because JavaScript is case sensitive.

    @@ -36,7 +36,7 @@

    Comments

    The syntax of comments is the same as in C++ and in many other languages:

    -
    // a one line comment
    +
    // a one line comment
     
     /* this is a longer,
      * multi-line comment
    @@ -97,7 +97,7 @@ 

    Evaluating variables

    An attempt to access an undeclared variable results in a {{jsxref("ReferenceError")}} exception being thrown:

    -
    var a;
    +
    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
    @@ -114,7 +114,7 @@ 

    Evaluating variables

    You can use undefined to determine whether a variable has a value. In the following code, the variable input is not assigned a value, and the if statement evaluates to true.

    -
    var input;
    +
    var input;
     if (input === undefined) {
       doThis();
     } else {
    @@ -124,18 +124,18 @@ 

    Evaluating variables

    The undefined value behaves as false when used in a boolean context. For example, the following code executes the function myFunction because the myArray element is undefined:

    -
    var myArray = [];
    +
    var myArray = [];
     if (!myArray[0]) myFunction();
     

    The undefined value converts to NaN when used in numeric context.

    -
    var a;
    +
    var a;
     a + 2;  // Evaluates to NaN

    When you evaluate a {{jsxref("null")}} variable, the null value behaves as 0 in numeric contexts and as false in boolean contexts. For example:

    -
    var n = null;
    +
    var n = null;
     console.log(n * 32); // Will log 0 to the console
     
    @@ -147,7 +147,7 @@

    Variable scope

    For example, the following code will log 5, because the scope of x is the global context (or the function context if the code is part of a function). The scope of x is not limited to the immediate if statement block.

    -
    if (true) {
    +
    if (true) {
       var x = 5;
     }
     console.log(x);  // x is 5
    @@ -155,7 +155,7 @@ 

    Variable scope

    This behavior changes when using the let declaration (introduced in ECMAScript 2015).

    -
    if (true) {
    +
    if (true) {
       let y = 5;
     }
     console.log(y);  // ReferenceError: y is not defined
    @@ -167,7 +167,7 @@ 

    Variable hoisting

    This concept is known as hoisting. Variables in JavaScript are, in a sense, "hoisted" (or "lifted") to the top of the function or statement. However, variables that are hoisted return a value of undefined. So even if you declare and initialize after you use or refer to this variable, it still returns undefined.

    -
    /**
    +
    /**
      * Example 1
      */
     console.log(x === undefined); // true
    @@ -187,7 +187,7 @@ 

    Variable hoisting

    The above examples will be interpreted the same as:

    -
    /**
    +
    /**
      * Example 1
      */
     var x;
    @@ -210,14 +210,14 @@ 

    Variable hoisting

    In ECMAScript 2015, let and const are hoisted but not initialized. Referencing the variable in the block before the variable declaration results in a {{jsxref("ReferenceError")}}, because the variable is in a "temporal dead zone" from the start of the block until the declaration is processed.

    -
    console.log(x); // ReferenceError
    +
    console.log(x); // ReferenceError
     let x = 3;

    Function hoisting

    In the case of functions, only function declarations are hoisted—but not the function expressions.

    -
    /* Function declaration */
    +
    /* Function declaration */
     
     foo(); // "bar"
     
    @@ -248,7 +248,7 @@ 

    Constants

    The syntax of a constant identifier is the same as any variable identifier: it must start with a letter, underscore, or dollar sign ($), and can contain alphabetic, numeric, or underscore characters.

    -
    const PI = 3.14;
    +
    const PI = 3.14;
     

    A constant cannot change value through assignment or be re-declared while the script is running. It must be initialized to a value.

    @@ -257,7 +257,7 @@

    Constants

    You cannot declare a constant with the same name as a function or variable in the same scope. For example:

    -
    // THIS WILL CAUSE AN ERROR
    +
    // THIS WILL CAUSE AN ERROR
     function f() {};
     const f = 5;
     
    @@ -272,12 +272,12 @@ 

    Constants

    However, the properties of objects assigned to constants are not protected, so the following statement is executed without problems.

    -
    const MY_OBJECT = {'key': 'value'};
    +
    const MY_OBJECT = {'key': 'value'};
     MY_OBJECT.key = 'otherValue';

    Also, the contents of an array are not protected, so the following statement is executed without problems.

    -
    const MY_ARRAY = ['HTML','CSS'];
    +
    const MY_ARRAY = ['HTML','CSS'];
     MY_ARRAY.push('JAVASCRIPT');
     console.log(MY_ARRAY); //logs ['HTML','CSS','JAVASCRIPT'];
     
    @@ -311,12 +311,12 @@

    Data type conversion

    So, for example, you could define a variable as follows:

    -
    var answer = 42;
    +
    var answer = 42;
     

    And later, you could assign the same variable a string value, for example:

    -
    answer = 'Thanks for all the fish...';
    +
    answer = 'Thanks for all the fish...';
     

    Because JavaScript is dynamically typed, this assignment does not cause an error message.

    @@ -325,13 +325,13 @@

    Numbers and the '+' operator

    In expressions involving numeric and string values with the + operator, JavaScript converts numeric values to strings. For example, consider the following statements:

    -
    x = 'The answer is ' + 42 // "The answer is 42"
    +
    x = 'The answer is ' + 42 // "The answer is 42"
     y = 42 + ' is the answer' // "42 is the answer"
     

    With all other operators, JavaScript does not convert numeric values to strings. For example:

    -
    '37' - 7 // 30
    +
    '37' - 7 // 30
     '37' + 7 // "377"
     
    @@ -350,11 +350,11 @@

    Converting strings to numbers

    Additionally, a best practice for parseInt is to always include the radix parameter. The radix parameter is used to specify which numerical system is to be used.

    -
    parseInt('101', 2) // 5
    +
    parseInt('101', 2) // 5

    An alternative method of retrieving a number from a string is with the + (unary plus) operator:

    -
    '1.1' + '1.1' // '1.11.1'
    +
    '1.1' + '1.1' // '1.11.1'
     (+'1.1') + (+'1.1') // 2.2
     // Note: the parentheses are added for clarity, not required.
    @@ -378,7 +378,7 @@

    Array literals

    The following example creates the coffees array with three elements and a length of three:

    -
    let coffees = ['French Roast', 'Colombian', 'Kona'];
    +
    let coffees = ['French Roast', 'Colombian', 'Kona'];
     
    @@ -395,7 +395,7 @@

    Extra commas in array literals

    You do not have to specify all elements in an array literal. If you put two commas in a row, the array fills in the value undefined for the unspecified elements. The following example creates the fish array:

    -
    let fish = ['Lion', , 'Angel'];
    +
    let fish = ['Lion', , 'Angel'];
     

    This array has two elements with values and one empty element:

    @@ -414,17 +414,17 @@

    Extra commas in array literals

    Note : Trailing commas can create errors in older browser versions and it is a best practice to remove them.

    -
    let myList = ['home', , 'school', ];
    +
    let myList = ['home', , 'school', ];
     

    In the following example, the length of the array is four, and myList[0] and myList[2] are missing.

    -
    let myList = [ ,'home', , 'school'];
    +
    let myList = [ ,'home', , 'school'];
     

    In the following example, the length of the array is four, and myList[1] and myList[3] are missing. Only the last comma is ignored.

    -
    let myList = ['home', , 'school', , ];
    +
    let myList = ['home', , 'school', , ];
     

    Understanding the behavior of extra commas is important to understanding JavaScript as a language.

    @@ -456,7 +456,7 @@

    Numeric literals

    Some examples of numeric literals are:

    -
    0, 117, -345, 123456789123456789n             (decimal, base 10)
    +
    0, 117, -345, 123456789123456789n             (decimal, base 10)
     015, 0001, -0o77, 0o777777777777n             (octal, base 8)
     0x1123, 0x00111, -0xF1A7, 0x123456789ABCDEFn  (hexadecimal, "hex" or base 16)
     0b11, 0b0011, -0b11, 0b11101001010101010101n  (binary, base 2)
    @@ -479,12 +479,12 @@ 

    Floating-point literals

    More succinctly, the syntax is:

    -
    [(+|-)][digits].[digits][(E|e)[(+|-)]digits]
    +
    [(+|-)][digits].[digits][(E|e)[(+|-)]digits]
     

    For example:

    -
    3.1415926
    +
    3.1415926
     -.123456789
     -3.1E+12
     .1e-23
    @@ -500,7 +500,7 @@ 

    Object literals

    The following is an example of an object literal. The first element of the car object defines a property, myCar, and assigns to it a new string, "Saturn"; the second element, the getCar property, is immediately assigned the result of invoking the function (carTypes("Honda")); the third element, the special property, uses an existing variable (sales).

    -
    var sales = 'Toyota';
    +
    var sales = 'Toyota';
     
     function carTypes(name) {
       if (name === 'Honda') {
    @@ -519,7 +519,7 @@ 

    Object literals

    Additionally, you can use a numeric or string literal for the name of a property or nest an object inside another. The following example uses these options.

    -
    var car = { manyCars: {a: 'Saab', b: 'Jeep'}, 7: 'Mazda' };
    +
    var car = { manyCars: {a: 'Saab', b: 'Jeep'}, 7: 'Mazda' };
     
     console.log(car.manyCars.b); // Jeep
     console.log(car[7]); // Mazda
    @@ -529,7 +529,7 @@ 

    Object literals

    Property names that are not valid identifiers cannot be accessed as a dot (.) property, but can be accessed and set with the array-like notation("[]").

    -
    var unusualPropertyNames = {
    +
    var unusualPropertyNames = {
       '': 'An empty string',
       '!': 'Bang!'
     }
    @@ -544,7 +544,7 @@ 

    Enhanced Object literals

    Together, these also bring object literals and class declarations closer together, and allow object-based design to benefit from some of the same conveniences.

    -
    var obj = {
    +
    var obj = {
         // __proto__
         __proto__: theProtoObj,
         // Shorthand for ‘handler: handler’
    @@ -563,7 +563,7 @@ 

    RegExp literals

    A regex literal (which is defined in detail later) is a pattern enclosed between slashes. The following is an example of a regex literal.

    -
    var re = /ab+c/;
    +
    var re = /ab+c/;

    String literals

    @@ -571,7 +571,7 @@

    String literals

    The following are examples of string literals:

    -
    'foo'
    +
    'foo'
     "bar"
     '1234'
     'one line \n another line'
    @@ -580,7 +580,7 @@ 

    String literals

    You can call any of the {{jsxref("String")}} object's methods on a string literal value. JavaScript automatically converts the string literal to a temporary String object, calls the method, then discards the temporary String object. You can also use the String.length property with a string literal:

    -
    // Will print the number of symbols in the string including whitespace.
    +
    // Will print the number of symbols in the string including whitespace.
     console.log("John's cat".length)  // In this case, 10.
     
    @@ -590,7 +590,7 @@

    String literals

    Optionally, a tag can be added to allow the string construction to be customized, avoiding injection attacks, or constructing higher-level data structures from string contents.

    -
    // Basic literal string creation
    +
    // Basic literal string creation
     `In JavaScript '\n' is a line-feed.`
     
     // Multiline strings
    @@ -615,7 +615,7 @@ 

    Using special characters in strings

    In addition to ordinary characters, you can also include special characters in strings, as shown in the following example.

    -
    'one line \n another line'
    +
    'one line \n another line'
     

    The following table lists the special characters that you can use in JavaScript strings.

    @@ -700,23 +700,23 @@

    Escaping characters

    You can insert a quotation mark inside a string by preceding it with a backslash. This is known as escaping the quotation mark. For example:

    -
    var quote = "He read \"The Cremation of Sam McGee\" by R.W. Service.";
    +
    var quote = "He read \"The Cremation of Sam McGee\" by R.W. Service.";
     console.log(quote);
     

    The result of this would be:

    -
    He read "The Cremation of Sam McGee" by R.W. Service.
    +
    He read "The Cremation of Sam McGee" by R.W. Service.
     

    To include a literal backslash inside a string, you must escape the backslash character. For example, to assign the file path c:\temp to a string, use the following:

    -
    var home = 'c:\\temp';
    +
    var home = 'c:\\temp';
     

    You can also escape line breaks by preceding them with backslash. The backslash and line break are both removed from the value of the string.

    -
    var str = 'this string \
    +
    var str = 'this string \
     is broken \
     across multiple \
     lines.'
    @@ -725,7 +725,7 @@ 

    Escaping characters

    Although JavaScript does not have "heredoc" syntax, you can get close by adding a line break escape and an escaped line break at the end of each line:

    -
    var poem =
    +
    var poem =
     'Roses are red,\n\
     Violets are blue.\n\
     Sugar is sweet,\n\
    @@ -734,7 +734,7 @@ 

    Escaping characters

    ECMAScript 2015 introduces a new type of literal, namely template literals. This allows for many new features, including multiline strings!

    -
    var poem =
    +
    var poem =
     `Roses are red,
     Violets are blue.
     Sugar is sweet,
    diff --git a/files/en-us/web/javascript/guide/indexed_collections/index.html b/files/en-us/web/javascript/guide/indexed_collections/index.html
    index 93d6407f6d8fb28..6050334bff16af8 100644
    --- a/files/en-us/web/javascript/guide/indexed_collections/index.html
    +++ b/files/en-us/web/javascript/guide/indexed_collections/index.html
    @@ -22,7 +22,7 @@ 

    Creating an array

    The following statements create equivalent arrays:

    -
    let arr = new Array(element0, element1, ..., elementN)
    +
    let arr = new Array(element0, element1, ..., elementN)
     let arr = Array(element0, element1, ..., elementN)
     let arr = [element0, element1, ..., elementN]
     
    @@ -33,7 +33,7 @@

    Creating an array

    To create an array with non-zero length, but without any items, either of the following can be used:

    -
    // This...
    +
    // This...
     let arr = new Array(arrayLength)
     
     // ...results in the same array as this
    @@ -50,7 +50,7 @@ 

    Creating an array

    In addition to a newly defined variable as shown above, arrays can also be assigned as a property of a new or an existing object:

    -
    let obj = {}
    +
    let obj = {}
     // ...
     obj.prop = [element0, element1, ..., elementN]
     
    @@ -60,7 +60,7 @@ 

    Creating an array

    If you wish to initialize an array with a single element, and the element happens to be a Number, you must use the bracket syntax. When a single Number value is passed to the Array() constructor or function, it is interpreted as an arrayLength, not as a single element.

    -
    let arr = [42]       // Creates an array with only one element:
    +
    let arr = [42]       // Creates an array with only one element:
                          // the number 42.
     
     let arr = Array(42)  // Creates an array with no elements
    @@ -73,20 +73,20 @@ 

    Creating an array

    Calling Array(N) results in a RangeError, if N is a non-whole number whose fractional portion is non-zero. The following example illustrates this behavior.

    -
    let arr = Array(9.3)   // RangeError: Invalid array length
    +
    let arr = Array(9.3)   // RangeError: Invalid array length
     

    If your code needs to create arrays with single elements of an arbitrary data type, it is safer to use array literals. Alternatively, create an empty array first before adding the single element to it.

    In ES2015, you can use the {{jsxref("Array.of")}} static method to create arrays with single element.

    -
    let wisenArray = Array.of(9.3)   // wisenArray contains only one element 9.3
    +
    let wisenArray = Array.of(9.3)   // wisenArray contains only one element 9.3

    Referring to array elements

    Because elements are also properties, you can access the using property accessors. Suppose you define the following array:

    -
    let myArray = ['Wind', 'Rain', 'Fire']
    +
    let myArray = ['Wind', 'Rain', 'Fire']
     

    You can refer to the first element of the array as myArray[0], the second element of the array as myArray[1], etc… The index of the elements begins with zero.

    @@ -94,7 +94,7 @@

    Referring to array elements

    Note: You can also use property accessors to access other properties of the array, like with an object.

    -
    let arr = ['one', 'two', 'three']
    +
    let arr = ['one', 'two', 'three']
     arr[2]          // three
     arr['length']   // 3
     
    @@ -104,7 +104,7 @@

    Populating an array

    You can populate an array by assigning values to its elements. For example:

    -
    let emp = []
    +
    let emp = []
     emp[0] = 'Casey Jones'
     emp[1] = 'Phil Lesh'
     emp[2] = 'August West'
    @@ -113,7 +113,7 @@ 

    Populating an array

    Note: If you supply a non-integer value to the array operator in the code above, a property will be created in the object representing the array, instead of an array element.

    -
    let arr = []
    +
    let arr = []
     arr[3.4] = 'Oranges'
     console.log(arr.length)                 // 0
     console.log(arr.hasOwnProperty(3.4))    // true
    @@ -122,7 +122,7 @@ 

    Populating an array

    You can also populate an array when you create it:

    -
    let myArray = new Array('Hello', myVar, 3.14159)
    +
    let myArray = new Array('Hello', myVar, 3.14159)
     // OR
     let myArray = ['Mango', 'Apple', 'Orange']
     
    @@ -135,7 +135,7 @@

    Understanding length

    Remember, JavaScript Array indexes are 0-based: they start at 0, not 1. This means that the length property will be one more than the highest index stored in the array:

    -
    let cats = []
    +
    let cats = []
     cats[30] = ['Dusty']
     console.log(cats.length) // 31
     
    @@ -144,7 +144,7 @@

    Understanding length

    Writing a value that is shorter than the number of stored items truncates the array. Writing 0 empties it entirely:

    -
    let cats = ['Dusty', 'Misty', 'Twiggy']
    +
    let cats = ['Dusty', 'Misty', 'Twiggy']
     console.log(cats.length)  // 3
     
     cats.length = 2
    @@ -161,7 +161,7 @@ 

    Iterating over arrays

    A common operation is to iterate over the values of an array, processing each one in some way. The simplest way to do this is as follows:

    -
    let colors = ['red', 'green', 'blue']
    +
    let colors = ['red', 'green', 'blue']
     for (let i = 0; i < colors.length; i++) {
       console.log(colors[i])
     }
    @@ -169,7 +169,7 @@ 

    Iterating over arrays

    If you know that none of the elements in your array evaluate to false in a boolean context—if your array consists only of DOM nodes, for example—you can use a more efficient idiom:

    -
    let divs = document.getElementsByTagName('div')
    +
    let divs = document.getElementsByTagName('div')
     for (let i = 0, div; div = divs[i]; i++) {
       /* Process div in some way */
     }
    @@ -179,7 +179,7 @@ 

    Iterating over arrays

    The {{jsxref("Array.forEach", "forEach()")}} method provides another way of iterating over an array:

    -
    let colors = ['red', 'green', 'blue']
    +
    let colors = ['red', 'green', 'blue']
     colors.forEach(function(color) {
       console.log(color)
     })
    @@ -190,7 +190,7 @@ 

    Iterating over arrays

    Alternatively, you can shorten the code for the forEach parameter with ES2015 Arrow Functions:

    -
    let colors = ['red', 'green', 'blue']
    +
    let colors = ['red', 'green', 'blue']
     colors.forEach(color => console.log(color))
     // red
     // green
    @@ -201,7 +201,7 @@ 

    Iterating over arrays

    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']
    +
    let array = ['first', 'second', , 'fourth']
     
     array.forEach(function(element) {
       console.log(element)
    @@ -233,54 +233,54 @@ 

    Array methods

    {{jsxref("Array.concat", "concat()")}} joins two or more arrays and returns a new array.

    -
    let myArray = new Array('1', '2', '3')
    +
    let myArray = new Array('1', '2', '3')
     myArray = myArray.concat('a', 'b', 'c')
     // myArray is now ["1", "2", "3", "a", "b", "c"]
     

    {{jsxref("Array.join", "join(delimiter = ',')")}} joins all elements of an array into a string.

    -
    let myArray = new Array('Wind', 'Rain', 'Fire')
    +
    let myArray = new Array('Wind', 'Rain', 'Fire')
     let list = myArray.join(' - ') // list is "Wind - Rain - Fire"
     

    {{jsxref("Array.push", "push()")}} adds one or more elements to the end of an array and returns the resulting length of the array.

    -
    let myArray = new Array('1', '2')
    +
    let myArray = new Array('1', '2')
     myArray.push('3')  // myArray is now ["1", "2", "3"]
     

    {{jsxref("Array.pop", "pop()")}} removes the last element from an array and returns that element.

    -
    let myArray = new Array('1', '2', '3')
    +
    let myArray = new Array('1', '2', '3')
     let last = myArray.pop()
     // myArray is now ["1", "2"], last = "3"
     

    {{jsxref("Array.shift", "shift()")}} removes the first element from an array and returns that element.

    -
    let myArray = new Array('1', '2', '3')
    +
    let myArray = new Array('1', '2', '3')
     let first = myArray.shift()
     // myArray is now ["2", "3"], first is "1"
     

    {{jsxref("Array.unshift", "unshift()")}} adds one or more elements to the front of an array and returns the new length of the array.

    -
    let myArray = new Array('1', '2', '3')
    +
    let myArray = new Array('1', '2', '3')
     myArray.unshift('4', '5')
     // myArray becomes ["4", "5", "1", "2", "3"]
     

    {{jsxref("Array.slice", "slice(start_index, upto_index)")}} extracts a section of an array and returns a new array.

    -
    let myArray = new Array('a', 'b', 'c', 'd', 'e')
    +
    let myArray = new Array('a', 'b', 'c', 'd', 'e')
     myArray = myArray.slice(1, 4)  // starts at index 1 and extracts all elements
                                    // until index 3, returning [ "b", "c", "d"]
     

    {{jsxref("Array.splice", "splice(index, count_to_remove, addElement1, addElement2, ...)")}} removes elements from an array and (optionally) replaces them. It returns the items which were removed from the array.

    -
    let myArray = new Array('1', '2', '3', '4', '5')
    +
    let myArray = new Array('1', '2', '3', '4', '5')
     myArray.splice(1, 3, 'a', 'b', 'c', 'd')
     // myArray is now ["1", "a", "b", "c", "d", "5"]
     // This code started at index one (or where the "2" was),
    @@ -290,14 +290,14 @@ 

    Array methods

    {{jsxref("Array.reverse", "reverse()")}} transposes the elements of an array, in place: the first array element becomes the last and the last becomes the first. It returns a reference to the array.

    -
    let myArray = new Array('1', '2', '3')
    +
    let myArray = new Array('1', '2', '3')
     myArray.reverse()
     // transposes the array so that myArray = ["3", "2", "1"]
     

    {{jsxref("Array.sort", "sort()")}} sorts the elements of an array in place, and returns a reference to the array.

    -
    let myArray = new Array('Wind', 'Rain', 'Fire')
    +
    let myArray = new Array('Wind', 'Rain', 'Fire')
     myArray.sort()
     // sorts the array so that myArray = ["Fire", "Rain", "Wind"]
     
    @@ -312,7 +312,7 @@

    Array methods

    For instance, the following will sort by the last letter of a string:

    -
    let sortFn = function(a, b) {
    +
    let sortFn = function(a, b) {
       if (a[a.length - 1] < b[b.length - 1]) return -1;
       if (a[a.length - 1] > b[b.length - 1]) return 1;
       if (a[a.length - 1] == b[b.length - 1]) return 0;
    @@ -328,7 +328,7 @@ 

    Array methods

    {{jsxref("Array.indexOf", "indexOf(searchElement[, fromIndex])")}} searches the array for searchElement and returns the index of the first match.

    -
    let a = ['a', 'b', 'a', 'b', 'a']
    +
    let a = ['a', 'b', 'a', 'b', 'a']
     console.log(a.indexOf('b'))     // logs 1
     
     // Now try again, starting from after the last match
    @@ -338,7 +338,7 @@ 

    Array methods

    {{jsxref("Array.lastIndexOf", "lastIndexOf(searchElement[, fromIndex])")}} works like indexOf, but starts at the end and searches backwards.

    -
    let a = ['a', 'b', 'c', 'd', 'a', 'b']
    +
    let a = ['a', 'b', 'c', 'd', 'a', 'b']
     console.log(a.lastIndexOf('b'))     // logs 5
     
     // Now try again, starting from before the last match
    @@ -348,28 +348,28 @@ 

    Array methods

    {{jsxref("Array.forEach", "forEach(callback[, thisObject])")}} executes callback on every array item and returns undefined.

    -
    let a = ['a', 'b', 'c']
    +
    let a = ['a', 'b', 'c']
     a.forEach(function(element) { console.log(element) })
     // logs each item in turn
     

    {{jsxref("Array.map", "map(callback[, thisObject])")}} returns a new array of the return value from executing callback on every array item.

    -
    let a1 = ['a', 'b', 'c']
    +
    let a1 = ['a', 'b', 'c']
     let a2 = a1.map(function(item) { return item.toUpperCase() })
     console.log(a2) // logs ['A', 'B', 'C']
     

    {{jsxref("Array.filter", "filter(callback[, thisObject])")}} returns a new array containing the items for which callback returned true.

    -
    let a1 = ['a', 10, 'b', 20, 'c', 30]
    +
    let a1 = ['a', 10, 'b', 20, 'c', 30]
     let a2 = a1.filter(function(item) { return typeof item === 'number'; })
     console.log(a2)  // logs [10, 20, 30]
     

    {{jsxref("Array.every", "every(callback[, thisObject])")}} returns true if callback returns true for every item in the array.

    -
    function isNumber(value) {
    +
    function isNumber(value) {
       return typeof value === 'number'
     }
     let a1 = [1, 2, 3]
    @@ -380,7 +380,7 @@ 

    Array methods

    {{jsxref("Array.some", "some(callback[, thisObject])")}} returns true if callback returns true for at least one item in the array.

    -
    function isNumber(value) {
    +
    function isNumber(value) {
       return typeof value === 'number'
     }
     let a1 = [1, 2, 3]
    @@ -399,7 +399,7 @@ 

    Array methods

    If callback needs access to the index of the item being processed, on access to the entire array, they are available as optional parameters.

    -
    let a = [10, 20, 30]
    +
    let a = [10, 20, 30]
     let total = a.reduce(function(accumulator, currentValue) { return accumulator + currentValue }, 0)
     console.log(total) // Prints 60
     
    @@ -414,7 +414,7 @@

    Multi-dimensional arrays

    The following code creates a two-dimensional array.

    -
    let a = new Array(4)
    +
    let a = new Array(4)
     for (let i = 0; i < 4; i++) {
       a[i] = new Array(4)
       for (let j = 0; j < 4; j++) {
    @@ -425,7 +425,7 @@ 

    Multi-dimensional arrays

    This example creates an array with the following rows:

    -
    Row 0: [0, 0] [0, 1] [0, 2] [0, 3]
    +
    Row 0: [0, 0] [0, 1] [0, 2] [0, 3]
     Row 1: [1, 0] [1, 1] [1, 2] [1, 3]
     Row 2: [2, 0] [2, 1] [2, 2] [2, 3]
     Row 3: [3, 0] [3, 1] [3, 2] [3, 3]
    @@ -435,7 +435,7 @@ 

    Using arrays to store other prop

    Arrays can also be used like objects, to store related information.

    -
    const arr = [1, 2, 3];
    +
    const arr = [1, 2, 3];
     arr.property = "value";
     console.log(arr.property);  // Logs "value"
     
    @@ -450,7 +450,7 @@

    Working with array-like objects

    Array methods cannot be called directly on array-like objects.

    -
    function printArguments() {
    +
    function printArguments() {
       arguments.forEach(function(item) {  // TypeError: arguments.forEach is not a function
         console.log(item);
       });
    @@ -459,7 +459,7 @@ 

    Working with array-like objects

    But you can call them indirectly using {{jsxref("Global_Objects/Function/call","Function.prototype.call()")}}.

    -
    function printArguments() {
    +
    function printArguments() {
       Array.prototype.forEach.call(arguments, function(item) {
         console.log(item);
       });
    @@ -468,7 +468,7 @@ 

    Working with array-like objects

    Array prototype methods can be used on strings as well, since they provide sequential access to their characters in a similar way to arrays:

    -
    Array.prototype.forEach.call('a string', function(chr) {
    +
    Array.prototype.forEach.call('a string', function(chr) {
       console.log(chr)
     })
     
    diff --git a/files/en-us/web/javascript/guide/introduction/index.html b/files/en-us/web/javascript/guide/introduction/index.html index d84781015290e83..438eec7cee90882 100644 --- a/files/en-us/web/javascript/guide/introduction/index.html +++ b/files/en-us/web/javascript/guide/introduction/index.html @@ -119,7 +119,7 @@

    Single-line input in the Web Conso

    The console works the exact same way as eval: the last expression entered is returned. For the sake of simplicity, it can be imagined that every time something is entered into the console, it is actually surrounded by console.log around eval, like so:

    -
    function greetMe(yourName) {
    +
    function greetMe(yourName) {
       alert("Hello " + yourName)
     }
     console.log(eval('3 + 5'))
    @@ -133,7 +133,7 @@ 

    Hello world

    To get started with writing JavaScript, open the Web Console in multi-line mode, and write your first "Hello world" JavaScript code:

    -
    (function(){
    +
    (function(){
       "use strict";
       /* Start of your code */
       function greetMe(yourName) {
    diff --git a/files/en-us/web/javascript/guide/iterators_and_generators/index.html b/files/en-us/web/javascript/guide/iterators_and_generators/index.html
    index 0c03825983c5afc..c465f20cefc1686 100644
    --- a/files/en-us/web/javascript/guide/iterators_and_generators/index.html
    +++ b/files/en-us/web/javascript/guide/iterators_and_generators/index.html
    @@ -43,7 +43,7 @@ 

    Iterators

    Here is an example which can do just that. It allows creation of a simple range iterator which defines a sequence of integers from start (inclusive) to end (exclusive) spaced step apart. Its final return value is the size of the sequence it created, tracked by the variable iterationCount.

    -
    function makeRangeIterator(start = 0, end = Infinity, step = 1) {
    +
    function makeRangeIterator(start = 0, end = Infinity, step = 1) {
         let nextIndex = start;
         let iterationCount = 0;
     
    @@ -65,7 +65,7 @@ 

    Iterators

    Using the iterator then looks like this:

    -
    const it = makeRangeIterator(1, 10, 2);
    +
    const it = makeRangeIterator(1, 10, 2);
     
     let result = it.next();
     while (!result.done) {
    @@ -91,7 +91,7 @@ 

    Generator functions

    We can now adapt the example from above. The behavior of this code is identical, but the implementation is much easier to write and read.

    -
    function* makeRangeIterator(start = 0, end = 100, step = 1) {
    +
    function* makeRangeIterator(start = 0, end = 100, step = 1) {
         let iterationCount = 0;
         for (let i = start; i < end; i += step) {
             iterationCount++;
    @@ -110,7 +110,7 @@ 

    Iterables

    Iterables which can iterate only once (such as Generators) customarily return this from their @@iterator method, whereas iterables which can be iterated many times must return a new iterator on each invocation of @@iterator.

    -
    function* makeIterator() {
    +
    function* makeIterator() {
         yield 1;
         yield 2;
     }
    @@ -141,7 +141,7 @@ 

    User-defined iterables

    You can make your own iterables like this:

    -
    const myIterable = {
    +
    const myIterable = {
         *[Symbol.iterator]() {
             yield 1;
             yield 2;
    @@ -169,7 +169,7 @@ 

    Syntaxes expecting iterables

    Some statements and expressions expect iterables. For example: the {{jsxref("Statements/for...of","for-of")}} loops, {{jsxref("Operators/yield*","yield*")}}.

    -
    for (let value of ['a', 'b', 'c']) {
    +
    for (let value of ['a', 'b', 'c']) {
         console.log(value);
     }
     // "a"
    @@ -204,7 +204,7 @@ 

    Advanced generators

    Here is the fibonacci generator using next(x) to restart the sequence:

    -
    function* fibonacci() {
    +
    function* fibonacci() {
       let current = 0;
       let next = 1;
       while (true) {
    diff --git a/files/en-us/web/javascript/guide/loops_and_iteration/index.html b/files/en-us/web/javascript/guide/loops_and_iteration/index.html
    index e9903287e1b0867..16a448873556b6f 100644
    --- a/files/en-us/web/javascript/guide/loops_and_iteration/index.html
    +++ b/files/en-us/web/javascript/guide/loops_and_iteration/index.html
    @@ -20,7 +20,7 @@
       take X steps in one direction, then Y steps in another. For example,
       the idea "Go five steps to the east" could be expressed this way as a loop:

    -
    for (let step = 0; step < 5; step++) {
    +
    for (let step = 0; step < 5; step++) {
       // Runs 5 times, with values of step 0 through 4.
       console.log('Walking east one step');
     }
    @@ -55,7 +55,7 @@ 

    for statement

    A for statement looks as follows:

    -
    for ([initialExpression]; [conditionExpression]; [incrementExpression])
    +
    for ([initialExpression]; [conditionExpression]; [incrementExpression])
       statement
     
    @@ -89,7 +89,7 @@

    Example

    element, performs the succeeding if statement, and increments i by after each pass through the loop.

    -
    <form name="selectForm">
    +
    <form name="selectForm">
       <p>
         <label for="musicTypes">Choose some music types, then click the button below:</label>
         <select id="musicTypes" name="musicTypes" multiple="multiple">
    @@ -130,7 +130,7 @@ 

    do...while statement

    A do...while statement looks as follows:

    -
    do
    +
    do
       statement
     while (condition);
     
    @@ -149,7 +149,7 @@

    Example

    In the following example, the do loop iterates at least once and reiterates until i is no longer less than 5.

    -
    let i = 0;
    +
    let i = 0;
     do {
       i += 1;
       console.log(i);
    @@ -161,7 +161,7 @@ 

    while statement

    specified condition evaluates to true. A while statement looks as follows:

    -
    while (condition)
    +
    while (condition)
       statement
     
    @@ -183,7 +183,7 @@

    Example 1

    The following while loop iterates as long as n is less than 3:

    -
    let n = 0;
    +
    let n = 0;
     let x = 0;
     while (n < 3) {
       n++;
    @@ -214,7 +214,7 @@ 

    Example 2

    following while loop execute forever because the condition never becomes false:

    -
    // Infinite loops are bad!
    +
    // Infinite loops are bad!
     while (true) {
       console.log('Hello, world!');
     }
    @@ -228,7 +228,7 @@

    labeled statement

    The syntax of the labeled statement looks like the following:

    -
    label :
    +
    label :
        statement
     
    @@ -241,7 +241,7 @@

    Example

    In this example, the label markLoop identifies a while loop.

    -
    markLoop:
    +
    markLoop:
     while (theMark === true) {
        doSomething();
     }
    @@ -261,7 +261,7 @@

    break statement

    The syntax of the break statement looks like this:

    -
    break;
    +
    break;
     break [label];
     
    @@ -277,7 +277,7 @@

    Example 1

    The following example iterates through the elements in an array until it finds the index of an element whose value is theValue:

    -
    for (let i = 0; i < a.length; i++) {
    +
    for (let i = 0; i < a.length; i++) {
       if (a[i] === theValue) {
         break;
       }
    @@ -286,7 +286,7 @@ 

    Example 1

    Example 2: Breaking to a label

    -
    let x = 0;
    +
    let x = 0;
     let z = 0;
     labelCancelLoops: while (true) {
       console.log('Outer loops: ' + x);
    @@ -324,7 +324,7 @@ 

    continue statement

    The syntax of the continue statement looks like the following:

    -
    continue [label];
    +
    continue [label];
     

    Example 1

    @@ -334,7 +334,7 @@

    Example 1

    n takes on the values 1, 3, 7, and 12.

    -
    let i = 0;
    +
    let i = 0;
     let n = 0;
     while (i < 5) {
       i++;
    @@ -374,7 +374,7 @@ 

    Example 2

    If continue had a label of checkiandj, the program would continue at the top of the checkiandj statement.

    -
    let i = 0;
    +
    let i = 0;
     let j = 10;
     checkiandj:
       while (i < 4) {
    @@ -400,7 +400,7 @@ 

    for...in statement

    JavaScript executes the specified statements. A for...in statement looks as follows:

    -
    for (variable in object)
    +
    for (variable in object)
       statement
     
    @@ -410,7 +410,7 @@

    Example

    iterates over all the object's properties and returns a string that lists the property names and their values.

    -
    function dump_props(obj, obj_name) {
    +
    function dump_props(obj, obj_name) {
       let result = '';
       for (let i in obj) {
         result += obj_name + '.' + i + ' = ' + obj[i] + '<br>';
    @@ -423,7 +423,7 @@ 

    Example

    For an object car with properties make and model, result would be:

    -
    car.make = Ford
    +
    car.make = Ford
     car.model = Mustang
     
    @@ -447,7 +447,7 @@

    for...of statement

    iteration hook with statements to be executed for the value of each distinct property.

    -
    for (variable of object)
    +
    for (variable of object)
       statement
     
    @@ -455,7 +455,7 @@

    for...of statement

    {{jsxref("statements/for...in","for...in")}} loop. While for...in iterates over property names, for...of iterates over property values:

    -
    const arr = [3, 5, 7];
    +
    const arr = [3, 5, 7];
     arr.foo = 'hello';
     
     for (let i in arr) {
    diff --git a/files/en-us/web/javascript/guide/modules/index.html b/files/en-us/web/javascript/guide/modules/index.html
    index b62b644d2c940a4..dfa22827dd5697e 100644
    --- a/files/en-us/web/javascript/guide/modules/index.html
    +++ b/files/en-us/web/javascript/guide/modules/index.html
    @@ -46,7 +46,7 @@ 

    Basic example structure

    In our first example (see basic-modules) we have a file structure as follows:

    -
    index.html
    +
    index.html
     main.js
     modules/
         canvas.js
    @@ -106,7 +106,7 @@ 

    Exporting module features

    The easiest way to use it is to place it in front of any items you want exported out of the module, for example:

    -
    export const name = 'square';
    +
    export const name = 'square';
     
     export function draw(ctx, length, x, y, color) {
       ctx.fillStyle = color;
    @@ -124,13 +124,13 @@ 

    Exporting module features

    A more convenient way of exporting all the items you want to export is to use a single export statement at the end of your module file, followed by a comma-separated list of the features you want to export wrapped in curly braces. For example:

    -
    export { name, draw, reportArea, reportPerimeter };
    +
    export { name, draw, reportArea, reportPerimeter };

    Importing features into your script

    Once you've exported some features out of your module, you need to import them into your script to be able to use them. The simplest way to do this is as follows:

    -
    import { name, draw, reportArea, reportPerimeter } from './modules/square.js';
    +
    import { name, draw, reportArea, reportPerimeter } from './modules/square.js';

    You use the {{JSxRef("Statements/import", "import")}} statement, followed by a comma-separated list of the features you want to import wrapped in curly braces, followed by the keyword from, followed by the path to the module file — a path relative to the site root, which for our basic-modules example would be /js-examples/modules/basic-modules.

    @@ -138,11 +138,11 @@

    Importing features into your script

    So for example:

    -
    /js-examples/modules/basic-modules/modules/square.js
    +
    /js-examples/modules/basic-modules/modules/square.js

    becomes

    -
    ./modules/square.js
    +
    ./modules/square.js

    You can see such lines in action in main.js.

    @@ -152,7 +152,7 @@

    Importing features into your script

    Once you've imported the features into your script, you can use them just like they were defined inside the same file. The following is found in main.js, below the import lines:

    -
    let myCanvas = create('myCanvas', document.body, 480, 320);
    +
    let myCanvas = create('myCanvas', document.body, 480, 320);
     let reportList = createReportList(myCanvas.id);
     
     let square1 = draw(myCanvas.ctx, 50, 50, 100, 'blue');
    @@ -170,11 +170,11 @@ 

    Applying the module to your HTML

    First of all, you need to include type="module" in the <script> element, to declare this script as a module. To import the main.js script, we use this:

    -
    <script type="module" src="main.js"></script>
    +
    <script type="module" src="main.js"></script>

    You can also embed the module's script directly into the HTML file by placing the JavaScript code within the body of the <script> element:

    -
    <script type="module">
    +
    <script type="module">
       /* JavaScript module code here */
     </script>
    @@ -200,23 +200,23 @@

    Default exports versus named expor

    Let's look at an example as we explain how it works. In our basic-modules square.js you can find a function called randomSquare() that creates a square with a random color, size, and position. We want to export this as our default, so at the bottom of the file we write this:

    -
    export default randomSquare;
    +
    export default randomSquare;

    Note the lack of curly braces.

    We could instead prepend export default onto the function and define it as an anonymous function, like this:

    -
    export default function(ctx) {
    +
    export default function(ctx) {
       ...
     }

    Over in our main.js file, we import the default function using this line:

    -
    import randomSquare from './modules/square.js';
    +
    import randomSquare from './modules/square.js';

    Again, note the lack of curly braces. This is because there is only one default export allowed per module, and we know that randomSquare is it. The above line is basically shorthand for:

    -
    import {default as randomSquare} from './modules/square.js';
    +
    import {default as randomSquare} from './modules/square.js';

    Note: The as syntax for renaming exported items is explained below in the Renaming imports and exports section.

    @@ -234,7 +234,7 @@

    Renaming imports and exports

    So for example, both of the following would do the same job, albeit in a slightly different way:

    -
    // inside module.js
    +
    // inside module.js
     export {
       function1 as newFunctionName,
       function2 as anotherNewFunctionName
    @@ -243,7 +243,7 @@ 

    Renaming imports and exports

    // inside main.js import { newFunctionName, anotherNewFunctionName } from './modules/module.js';
    -
    // inside module.js
    +
    // inside module.js
     export { function1, function2 };
     
     // inside main.js
    @@ -254,11 +254,11 @@ 

    Renaming imports and exports

    Inside each of these modules, we've got features with the same names being exported, and therefore each has the same export statement at the bottom:

    -
    export { name, draw, reportArea, reportPerimeter };
    +
    export { name, draw, reportArea, reportPerimeter };

    When importing these into main.js, if we tried to use

    -
    import { name, draw, reportArea, reportPerimeter } from './modules/square.js';
    +
    import { name, draw, reportArea, reportPerimeter } from './modules/square.js';
     import { name, draw, reportArea, reportPerimeter } from './modules/circle.js';
     import { name, draw, reportArea, reportPerimeter } from './modules/triangle.js';
    @@ -266,7 +266,7 @@

    Renaming imports and exports

    Instead we need to rename the imports so that they are unique:

    -
    import { name as squareName,
    +
    import { name as squareName,
              draw as drawSquare,
              reportArea as reportSquareArea,
              reportPerimeter as reportSquarePerimeter } from './modules/square.js';
    @@ -283,13 +283,13 @@ 

    Renaming imports and exports

    Note that you could solve the problem in the module files instead, e.g.

    -
    // in square.js
    +
    // in square.js
     export { name as squareName,
              draw as drawSquare,
              reportArea as reportSquareArea,
              reportPerimeter as reportSquarePerimeter };
    -
    // in main.js
    +
    // in main.js
     import { squareName, drawSquare, reportSquareArea, reportSquarePerimeter } from './modules/square.js';

    And it would work just the same. What style you use is up to you, however it arguably makes more sense to leave your module code alone, and make the changes in the imports. This especially makes sense when you are importing from third party modules that you don't have any control over.

    @@ -298,21 +298,21 @@

    Creating a module object

    The above method works OK, but it's a little messy and longwinded. An even better solution is to import each module's features inside a module object. The following syntax form does that:

    -
    import * as Module from './modules/module.js';
    +
    import * as Module from './modules/module.js';

    This grabs all the exports available inside module.js, and makes them available as members of an object Module, effectively giving it its own namespace. So for example:

    -
    Module.function1()
    +
    Module.function1()
     Module.function2()
     etc.

    Again, let's look at a real example. If you go to our module-objects directory, you'll see the same example again, but rewritten to take advantage of this new syntax. In the modules, the exports are all in the following simple form:

    -
    export { name, draw, reportArea, reportPerimeter };
    +
    export { name, draw, reportArea, reportPerimeter };

    The imports on the other hand look like this:

    -
    import * as Canvas from './modules/canvas.js';
    +
    import * as Canvas from './modules/canvas.js';
     
     import * as Square from './modules/square.js';
     import * as Circle from './modules/circle.js';
    @@ -320,7 +320,7 @@ 

    Creating a module object

    In each case, you can now access the module's imports underneath the specified object name, for example:

    -
    let square1 = Square.draw(myCanvas.ctx, 50, 50, 100, 'blue');
    +
    let square1 = Square.draw(myCanvas.ctx, 50, 50, 100, 'blue');
     Square.reportArea(square1.length, reportList);
     Square.reportPerimeter(square1.length, reportList);
    @@ -332,7 +332,7 @@

    Modules and classes

    You can see an example of our shape drawing module rewritten with ES classes in our classes directory. As an example, the square.js file now contains all its functionality in a single class:

    -
    class Square {
    +
    class Square {
       constructor(ctx, listId, length, x, y, color) {
         ...
       }
    @@ -346,15 +346,15 @@ 

    Modules and classes

    which we then export:

    -
    export { Square };
    +
    export { Square };

    Over in main.js, we import it like this:

    -
    import { Square } from './modules/square.js';
    +
    import { Square } from './modules/square.js';

    And then use the class to draw our square:

    -
    let square1 = new Square(myCanvas.ctx, myCanvas.listId, 50, 50, 100, 'blue');
    +
    let square1 = new Square(myCanvas.ctx, myCanvas.listId, 50, 50, 100, 'blue');
     square1.draw();
     square1.reportArea();
     square1.reportPerimeter();
    @@ -363,12 +363,12 @@

    Aggregating modules

    There will be times where you'll want to aggregate modules together. You might have multiple levels of dependencies, where you want to simplify things, combining several submodules into one parent module. This is possible using export syntax of the following forms in the parent module:

    -
    export * from 'x.js'
    +
    export * from 'x.js'
     export { name } from 'x.js'

    For an example, see our module-aggregation directory. In this example (based on our earlier classes example) we've got an extra module called shapes.js, which aggregates all the functionality from circle.js, square.js, and triangle.js together. We've also moved our submodules inside a subdirectory inside the modules directory called shapes. So the module structure in this example is:

    -
    modules/
    +
    modules/
       canvas.js
       shapes.js
       shapes/
    @@ -378,11 +378,11 @@ 

    Aggregating modules

    In each of the submodules, the export is of the same form, e.g.

    -
    export { Square };
    +
    export { Square };

    Next up comes the aggregation part. Inside shapes.js, we include the following lines:

    -
    export { Square } from './shapes/square.js';
    +
    export { Square } from './shapes/square.js';
     export { Triangle } from './shapes/triangle.js';
     export { Circle } from './shapes/circle.js';
    @@ -394,13 +394,13 @@

    Aggregating modules

    So now in the main.js file, we can get access to all three module classes by replacing

    -
    import { Square } from './modules/square.js';
    +
    import { Square } from './modules/square.js';
     import { Circle } from './modules/circle.js';
     import { Triangle } from './modules/triangle.js';

    with the following single line:

    -
    import { Square, Circle, Triangle } from './modules/shapes.js';
    +
    import { Square, Circle, Triangle } from './modules/shapes.js';

    Dynamic module loading

    @@ -408,7 +408,7 @@

    Dynamic module loading

    This new functionality allows you to call {{JSxRef("Statements/import", "import()", "#Dynamic_Imports")}} as a function, passing it the path to the module as a parameter. It returns a {{JSxRef("Promise")}}, which fulfills with a module object (see Creating a module object) giving you access to that object's exports, e.g.

    -
    import('./modules/myModule.js')
    +
    import('./modules/myModule.js')
       .then((module) => {
         // Do something with the module.
       });
    @@ -419,11 +419,11 @@

    Dynamic module loading

    Over in main.js we've grabbed a reference to each button using a Document.querySelector() call, for example:

    -
    let squareBtn = document.querySelector('.square');
    +
    let squareBtn = document.querySelector('.square');

    We then attach an event listener to each button so that when pressed, the relevant module is dynamically loaded and used to draw the shape:

    -
    squareBtn.addEventListener('click', () => {
    +
    squareBtn.addEventListener('click', () => {
       import('./modules/square.js').then((Module) => {
         let square1 = new Module.Square(myCanvas.ctx, myCanvas.listId, 50, 50, 100, 'blue');
         square1.draw();
    @@ -443,7 +443,7 @@ 

    Top level await

    Firstly we'll declare our color palette in a separate colors.json file:

    -
    +
     {
       "yellow": "#F4D03F",
       "green": "#52BE80",
    @@ -455,7 +455,7 @@ 

    Top level await

    Then we'll create a module called getColors.js which uses a fetch request to load the colors.json file and return the data as an object.

    -
    +
     // fetch request
     const colors = fetch('../data/colors.json')
     	.then(response => response.json());
    @@ -469,7 +469,7 @@ 

    Top level await

    Let's include this module in our main.js file:

    -
    +
     import colors from './modules/getColors.js';
     import { Canvas } from './modules/canvas.js';
     
    @@ -481,7 +481,7 @@ 

    Top level await

    We'll use colors instead of the previously used strings when calling our shape functions:

    -
    +
     ...
     
     let square1 = new Module.Square(myCanvas.ctx, myCanvas.listId, 50, 50, 100, colors.blue);
    diff --git a/files/en-us/web/javascript/guide/numbers_and_dates/index.html b/files/en-us/web/javascript/guide/numbers_and_dates/index.html
    index 57e4751294d5be1..7a29d76b0d3622e 100644
    --- a/files/en-us/web/javascript/guide/numbers_and_dates/index.html
    +++ b/files/en-us/web/javascript/guide/numbers_and_dates/index.html
    @@ -33,7 +33,7 @@ 

    Numbers

    Decimal numbers

    -
    1234567890
    +
    1234567890
     42
     
     // Caution when using leading zeros:
    @@ -48,7 +48,7 @@ 

    Binary numbers

    Binary number syntax uses a leading zero followed by a lowercase or uppercase Latin letter "B" (0b or 0B). If the digits after the 0b are not 0 or 1, the following {{jsxref("SyntaxError")}} is thrown: "Missing binary digits after 0b".

    -
    var FLT_SIGNBIT  = 0b10000000000000000000000000000000; // 2147483648
    +
    var FLT_SIGNBIT  = 0b10000000000000000000000000000000; // 2147483648
     var FLT_EXPONENT = 0b01111111100000000000000000000000; // 2139095040
     var FLT_MANTISSA = 0B00000000011111111111111111111111; // 8388607
    @@ -56,27 +56,27 @@

    Octal numbers

    Octal number syntax uses a leading zero. If the digits after the 0 are outside the range 0 through 7, the number will be interpreted as a decimal number.

    -
    var n = 0755; // 493
    +
    var n = 0755; // 493
     var m = 0644; // 420
     

    Strict mode in ECMAScript 5 forbids octal syntax. Octal syntax isn't part of ECMAScript 5, but it's supported in all browsers by prefixing the octal number with a zero: 0644 === 420 and "\045" === "%". In ECMAScript 2015, octal numbers are supported if they are prefixed with 0o, e.g.:

    -
    var a = 0o10; // ES2015: 8
    +
    var a = 0o10; // ES2015: 8
     

    Hexadecimal numbers

    Hexadecimal number syntax uses a leading zero followed by a lowercase or uppercase Latin letter "X" (0x or 0X). If the digits after 0x are outside the range (0123456789ABCDEF), the following {{jsxref("SyntaxError")}} is thrown: "Identifier starts immediately after numeric literal".

    -
    0xFFFFFFFFFFFFFFFFF // 295147905179352830000
    +
    0xFFFFFFFFFFFFFFFFF // 295147905179352830000
     0x123456789ABCDEF   // 81985529216486900
     0XA                 // 10
     

    Exponentiation

    -
    1E3   // 1000
    +
    1E3   // 1000
     2e6   // 2000000
     0.1e2 // 10
    @@ -84,7 +84,7 @@

    Number object

    The built-in {{jsxref("Number")}} object has properties for numerical constants, such as maximum value, not-a-number, and infinity. You cannot change the values of these properties and you use them as follows:

    -
    var biggestNum = Number.MAX_VALUE;
    +
    var biggestNum = Number.MAX_VALUE;
     var smallestNum = Number.MIN_VALUE;
     var infiniteNum = Number.POSITIVE_INFINITY;
     var negInfiniteNum = Number.NEGATIVE_INFINITY;
    @@ -207,12 +207,12 @@ 

    Math object

    The built-in {{jsxref("Math")}} object has properties and methods for mathematical constants and functions. For example, the Math object's PI property has the value of pi (3.141...), which you would use in an application as

    -
    Math.PI
    +
    Math.PI
     

    Similarly, standard mathematical functions are methods of Math. These include trigonometric, logarithmic, exponential, and other functions. For example, if you want to use the trigonometric function sine, you would write

    -
    Math.sin(1.56)
    +
    Math.sin(1.56)
     

    Note that all trigonometric methods of Math take arguments in radians.

    @@ -299,7 +299,7 @@

    Date object

    To create a Date object:

    -
    var dateObjectName = new Date([parameters]);
    +
    var dateObjectName = new Date([parameters]);
     

    where dateObjectName is the name of the Date object being created; it can be a new object or a property of an existing object.

    @@ -339,7 +339,7 @@

    Methods of the Date< object

    For example, suppose you define the following date:

    -
    var Xmas95 = new Date('December 25, 1995');
    +
    var Xmas95 = new Date('December 25, 1995');
     

    Then Xmas95.getMonth() returns 11, and Xmas95.getFullYear() returns 1995.

    @@ -348,7 +348,7 @@

    Methods of the Date< object

    For example, the following code displays the number of days left in the current year:

    -
    var today = new Date();
    +
    var today = new Date();
     var endYear = new Date(1995, 11, 31, 23, 59, 59, 999); // Set day and month
     endYear.setFullYear(today.getFullYear()); // Set year to this year
     var msPerDay = 24 * 60 * 60 * 1000; // Number of milliseconds per day
    @@ -360,7 +360,7 @@ 

    Methods of the Date< object

    The parse method is useful for assigning values from date strings to existing Date objects. For example, the following code uses parse and setTime to assign a date value to the IPOdate object:

    -
    var IPOdate = new Date();
    +
    var IPOdate = new Date();
     IPOdate.setTime(Date.parse('Aug 9, 1995'));
     
    @@ -368,7 +368,7 @@

    Example

    In the following example, the function JSClock() returns the time in the format of a digital clock.

    -
    function JSClock() {
    +
    function JSClock() {
       var time = new Date();
       var hour = time.getHours();
       var minute = time.getMinutes();
    diff --git a/files/en-us/web/javascript/guide/regular_expressions/character_classes/index.html b/files/en-us/web/javascript/guide/regular_expressions/character_classes/index.html
    index 38d441d9540082d..56885f7fa794017 100644
    --- a/files/en-us/web/javascript/guide/regular_expressions/character_classes/index.html
    +++ b/files/en-us/web/javascript/guide/regular_expressions/character_classes/index.html
    @@ -148,7 +148,7 @@ 

    Examples

    Looking for a series of digits

    -
    var randomData = "015 354 8787 687351 3512 8735";
    +
    var randomData = "015 354 8787 687351 3512 8735";
     var regexpFourDigits = /\b\d{4}\b/g;
     // \b indicates a boundary (i.e. do not start matching in the middle of a word)
     // \d{4} indicates a digit, four times
    @@ -160,7 +160,7 @@ 

    Looking for a series of digits

    Looking for a word (from the latin alphabet) starting with A

    -
    var aliceExcerpt = "I’m sure I’m not Ada,’ she said, ‘for her hair goes in such long ringlets, and mine doesn’t go in ringlets at all.";
    +
    var aliceExcerpt = "I’m sure I’m not Ada,’ she said, ‘for her hair goes in such long ringlets, and mine doesn’t go in ringlets at all.";
     var regexpWordStartingWithA = /\b[aA]\w+/g;
     // \b indicates a boundary (i.e. do not start matching in the middle of a word)
     // [aA] indicates the letter a or A
    @@ -174,7 +174,7 @@ 

    Looking for a word (from Uni

    Instead of the Latin alphabet, we can use a range of Unicode characters to identify a word (thus being able to deal with text in other languages like Russian or Arabic). The "Basic Multilingual Plane" of Unicode contains most of the characters used around the world and we can use character classes and ranges to match words written with those characters.

    -
    var nonEnglishText = "Приключения Алисы в Стране чудес";
    +
    var nonEnglishText = "Приключения Алисы в Стране чудес";
     var regexpBMPWord = /([\u0000-\u0019\u0021-\uFFFF])+/gu;
     // BMP goes through U+0000 to U+FFFF but space is U+0020
     
    diff --git a/files/en-us/web/javascript/guide/regular_expressions/cheatsheet/index.html b/files/en-us/web/javascript/guide/regular_expressions/cheatsheet/index.html
    index 44912098e16f2d2..4e4abf38a43b483 100644
    --- a/files/en-us/web/javascript/guide/regular_expressions/cheatsheet/index.html
    +++ b/files/en-us/web/javascript/guide/regular_expressions/cheatsheet/index.html
    @@ -408,7 +408,7 @@ 

    If you are looking to contribute to this document, please also edit the original article

    -
    // Non-binary values
    +
    // Non-binary values
     \p{UnicodePropertyValue}
     \p{UnicodePropertyName=UnicodePropertyValue}
     
    diff --git a/files/en-us/web/javascript/guide/regular_expressions/groups_and_ranges/index.html b/files/en-us/web/javascript/guide/regular_expressions/groups_and_ranges/index.html
    index d2be3cd527e3bf6..8111e4689751572 100644
    --- a/files/en-us/web/javascript/guide/regular_expressions/groups_and_ranges/index.html
    +++ b/files/en-us/web/javascript/guide/regular_expressions/groups_and_ranges/index.html
    @@ -109,7 +109,7 @@ 

    Examples

    Counting vowels

    -
    var aliceExcerpt = "There was a long silence after this, and Alice could only hear whispers now and then.";
    +
    var aliceExcerpt = "There was a long silence after this, and Alice could only hear whispers now and then.";
     var regexpVowels = /[aeiouy]/g;
     
     console.log("Number of vowels:", aliceExcerpt.match(regexpVowels).length);
    @@ -117,7 +117,7 @@ 

    Counting vowels

    Using groups

    -
    let personList = `First_Name: John, Last_Name: Doe
    +
    let personList = `First_Name: John, Last_Name: Doe
     First_Name: Jane, Last_Name: Smith`;
     
     let regexpNames =  /First_Name: (\w+), Last_Name: (\w+)/mg;
    @@ -129,7 +129,7 @@ 

    Using groups

    Using named groups

    -
    let personList = `First_Name: John, Last_Name: Doe
    +
    let personList = `First_Name: John, Last_Name: Doe
     First_Name: Jane, Last_Name: Smith`;
     
     let regexpNames =  /First_Name: (?<firstname>\w+), Last_Name: (?<lastname>\w+)/mg;
    diff --git a/files/en-us/web/javascript/guide/regular_expressions/index.html b/files/en-us/web/javascript/guide/regular_expressions/index.html
    index 11f6a275c5e6044..2ed27141a609513 100644
    --- a/files/en-us/web/javascript/guide/regular_expressions/index.html
    +++ b/files/en-us/web/javascript/guide/regular_expressions/index.html
    @@ -22,7 +22,7 @@ 

    Creating a regular expression

  • Using a regular expression literal, which consists of a pattern enclosed between slashes, as follows:

    -
    let re = /ab+c/;
    +  
    let re = /ab+c/;
     

    Regular expression literals provide compilation of the regular expression when the script is loaded. If the regular expression remains constant, using this can improve performance.

    @@ -30,7 +30,7 @@

    Creating a regular expression

  • Or calling the constructor function of the {{jsxref("RegExp")}} object, as follows:

    -
    let re = new RegExp('ab+c');
    +  
    let re = new RegExp('ab+c');
     

    Using the constructor function provides runtime compilation of the regular expression. Use the constructor function when you know the regular expression pattern will be changing, or you don't know the pattern and are getting it from another source, such as user input.

    @@ -126,7 +126,7 @@

    Escaping

    If escape strings are not already part of your pattern you can add them using {{jsxref('String.replace')}}:

    -
    function escapeRegExp(string) {
    +
    function escapeRegExp(string) {
       return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
     }
     
    @@ -191,13 +191,13 @@

    Using regular expressions in Ja

    In the following example, the script uses the exec() method to find a match in a string.

    -
    var myRe = /d(b+)d/g;
    +
    var myRe = /d(b+)d/g;
     var myArray = myRe.exec('cdbbdbsbz');
     

    If you do not need to access the properties of the regular expression, an alternative way of creating myArray is with this script:

    -
    var myArray = /d(b+)d/g.exec('cdbbdbsbz');
    +
    var myArray = /d(b+)d/g.exec('cdbbdbsbz');
         // similar to "cdbbdbsbz".match(/d(b+)d/g); however,
         // "cdbbdbsbz".match(/d(b+)d/g) outputs Array [ "dbbd" ], while
         // /d(b+)d/g.exec('cdbbdbsbz') outputs Array [ 'dbbd', 'bb', index: 1, input: 'cdbbdbsbz' ].
    @@ -207,7 +207,7 @@ 

    Using regular expressions in Ja

    If you want to construct the regular expression from a string, yet another alternative is this script:

    -
    var myRe = new RegExp('d(b+)d', 'g');
    +
    var myRe = new RegExp('d(b+)d', 'g');
     var myArray = myRe.exec('cdbbdbsbz');
     
    @@ -261,7 +261,7 @@

    Using regular expressions in Ja

    As shown in the second form of this example, you can use a regular expression created with an object initializer without assigning it to a variable. If you do, however, every occurrence is a new regular expression. For this reason, if you use this form without assigning it to a variable, you cannot subsequently access the properties of that regular expression. For example, assume you have this script:

    -
    var myRe = /d(b+)d/g;
    +
    var myRe = /d(b+)d/g;
     var myArray = myRe.exec('cdbbdbsbz');
     console.log('The value of lastIndex is ' + myRe.lastIndex);
     
    @@ -270,7 +270,7 @@ 

    Using regular expressions in Ja

    However, if you have this script:

    -
    var myArray = /d(b+)d/g.exec('cdbbdbsbz');
    +
    var myArray = /d(b+)d/g.exec('cdbbdbsbz');
     console.log('The value of lastIndex is ' + /d(b+)d/g.lastIndex);
     
     // "The value of lastIndex is 0"
    @@ -327,19 +327,19 @@ 

    Advanced searching with flags

    To include a flag with the regular expression, use this syntax:

    -
    var re = /pattern/flags;
    +
    var re = /pattern/flags;
     

    or

    -
    var re = new RegExp('pattern', 'flags');
    +
    var re = new RegExp('pattern', 'flags');
     

    Note that the flags are an integral part of a regular expression. They cannot be added or removed later.

    For example, re = /\w+\s/g creates a regular expression that looks for one or more characters followed by a space, and it looks for this combination throughout the string.

    -
    var re = /\w+\s/g;
    +
    var re = /\w+\s/g;
     var str = 'fee fi fo fum';
     var myArray = str.match(re);
     console.log(myArray);
    @@ -349,19 +349,19 @@ 

    Advanced searching with flags

    You could replace the line:

    -
    var re = /\w+\s/g;
    +
    var re = /\w+\s/g;
     

    with:

    -
    var re = new RegExp('\\w+\\s', 'g');
    +
    var re = new RegExp('\\w+\\s', 'g');
     

    and get the same result.

    The behavior associated with the g flag is different when the .exec() method is used.  The roles of "class" and "argument" get reversed: In the case of .match(), the string class (or data type) owns the method and the regular expression is just an argument, while in the case of .exec(), it is the regular expression that owns the method, with the string being the argument.  Contrast this str.match(re) versus re.exec(str).  The g flag is used with the .exec() method to get iterative progression.

    -
    var xArray; while(xArray = re.exec(str)) console.log(xArray);
    +
    var xArray; while(xArray = re.exec(str)) console.log(xArray);
     // produces:
     // ["fee ", index: 0, input: "fee fi fo fum"]
     // ["fi ", index: 4, input: "fee fi fo fum"]
    @@ -398,7 +398,7 @@ 

    Using special characters to ve

    HTML

    -
    <p>
    +
    <p>
       Enter your phone number (with area code) and then click "Check".
       <br>
       The expected format is like ###-###-####.
    @@ -410,7 +410,7 @@ 

    HTML

    JavaScript

    -
    var re = /(?:\d{3}|\(\d{3}\))([-\/\.])\d{3}\1\d{4}/;
    +
    var re = /(?:\d{3}|\(\d{3}\))([-\/\.])\d{3}\1\d{4}/;
     function testInfo(phoneInput) {
       var OK = re.exec(phoneInput.value);
       if (!OK) {
    diff --git a/files/en-us/web/javascript/guide/regular_expressions/quantifiers/index.html b/files/en-us/web/javascript/guide/regular_expressions/quantifiers/index.html
    index 6195268d2db7cd3..ef569a459c23a9c 100644
    --- a/files/en-us/web/javascript/guide/regular_expressions/quantifiers/index.html
    +++ b/files/en-us/web/javascript/guide/regular_expressions/quantifiers/index.html
    @@ -94,7 +94,7 @@ 

    Examples

    Repeated pattern

    -
    var wordEndingWithAs = /\w+a+\b/;
    +
    var wordEndingWithAs = /\w+a+\b/;
     var delicateMessage = "This is Spartaaaaaaa";
     
     console.table(delicateMessage.match(wordEndingWithAs)); // [ "Spartaaaaaaa" ]
    @@ -102,7 +102,7 @@ 

    Repeated pattern

    Counting characters

    -
    var singleLetterWord = /\b\w\b/g;
    +
    var singleLetterWord = /\b\w\b/g;
     var notSoLongWord = /\b\w{1,6}\b/g;
     var loooongWord = /\b\w{13,}\b/g;
     
    @@ -115,7 +115,7 @@ 

    Counting characters

    Optional character

    -
    var britishText = "He asked his neighbour a favour.";
    +
    var britishText = "He asked his neighbour a favour.";
     var americanText = "He asked his neighbor a favor.";
     
     var regexpEnding = /\w+ou?r/g;
    @@ -133,7 +133,7 @@ 

    Optional character

    Greedy versus non-greedy

    -
    var text = "I must be getting somewhere near the centre of the earth.";
    +
    var text = "I must be getting somewhere near the centre of the earth.";
     var greedyRegexp = /[\w ]+/;
     // [\w ]      a letter of the latin alphabet or a whitespace
     //      +     one or several times
    diff --git a/files/en-us/web/javascript/guide/regular_expressions/unicode_property_escapes/index.html b/files/en-us/web/javascript/guide/regular_expressions/unicode_property_escapes/index.html
    index 2846462ab2c25be..68586b5e80236e9 100644
    --- a/files/en-us/web/javascript/guide/regular_expressions/unicode_property_escapes/index.html
    +++ b/files/en-us/web/javascript/guide/regular_expressions/unicode_property_escapes/index.html
    @@ -27,7 +27,7 @@ 

    Syntax

    -
    // Non-binary values
    +
    // Non-binary values
     \p{UnicodePropertyValue}
     \p{UnicodePropertyName=UnicodePropertyValue}
     
    @@ -72,7 +72,7 @@ 

    General categories

    They can be used to match letters, numbers, symbols, punctuations, spaces, etc. For a more exhaustive list of general categories, please refer to the Unicode specification.

    -
    // finding all the letters of a text
    +
    // finding all the letters of a text
     let story = "It’s the Cheshire Cat: now I shall have somebody to talk to.";
     
     // Most explicit form
    @@ -94,7 +94,7 @@ 

    Scripts and script extensions

    For example, A belongs to the Latin script and ε to the Greek script.

    -
    let mixedCharacters = "aεЛ";
    +
    let mixedCharacters = "aεЛ";
     
     // Using the canonical "long" name of the script
     mixedCharacters.match(/\p{Script=Latin}/u); // a
    @@ -110,7 +110,7 @@ 

    Scripts and script extensions

    If a character is used in a limited set of scripts, the Script property will only match for the "predominant" used script. If we want to match characters based on a "non-predominant" script, we could use the Script_Extensions property (Scx for short).

    -
    // ٢ is the digit 2 in Arabic-Indic notation
    +
    // ٢ 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
     
    @@ -127,7 +127,7 @@ 

    Unicode property escapes

    Unicode property escapes categories encompass much more characters and \p{Letter} or \p{Number} will work for any script.

    -
    // Trying to use ranges to avoid \w limitations:
    +
    // Trying to use ranges to avoid \w limitations:
     
     const nonEnglishText = "Приключения Алисы в Стране чудес";
     const regexpBMPWord = /([\u0000-\u0019\u0021-\uFFFF])+/gu;
    diff --git a/files/en-us/web/javascript/guide/using_promises/index.html b/files/en-us/web/javascript/guide/using_promises/index.html
    index 519b284686b2aaf..d2eb053e19019a4 100644
    --- a/files/en-us/web/javascript/guide/using_promises/index.html
    +++ b/files/en-us/web/javascript/guide/using_promises/index.html
    @@ -20,7 +20,7 @@
     
     

    Here's some code that uses createAudioFileAsync():

    -
    function successCallback(result) {
    +
    function successCallback(result) {
       console.log("Audio file ready at URL: " + result);
     }
     
    @@ -33,7 +33,7 @@
     
     

    If createAudioFileAsync() were rewritten to return a promise, you would attach your callbacks to it instead:

    -
    createAudioFileAsync(audioSettings).then(successCallback, failureCallback);
    +
    createAudioFileAsync(audioSettings).then(successCallback, failureCallback);

    This convention has several advantages. We will explore each one.

    @@ -55,13 +55,13 @@

    Chaining

    Here's the magic: the then() function returns a new promise, different from the original:

    -
    const promise = doSomething();
    +
    const promise = doSomething();
     const promise2 = promise.then(successCallback, failureCallback);
     

    or

    -
    const promise2 = doSomething().then(successCallback, failureCallback);
    +
    const promise2 = doSomething().then(successCallback, failureCallback);
     

    This second promise (promise2) represents the completion not just of doSomething(), but also of the successCallback or failureCallback you passed in, which can be other asynchronous functions returning a promise. When that's the case, any callbacks added to promise2 get queued behind the promise returned by either successCallback or failureCallback.

    @@ -70,7 +70,7 @@

    Chaining

    In the old days, doing several asynchronous operations in a row would lead to the classic callback pyramid of doom:

    -
    doSomething(function(result) {
    +
    doSomething(function(result) {
       doSomethingElse(result, function(newResult) {
         doThirdThing(newResult, function(finalResult) {
           console.log('Got the final result: ' + finalResult);
    @@ -81,7 +81,7 @@ 

    Chaining

    With modern functions, we attach our callbacks to the returned promises instead, forming a promise chain:

    -
    doSomething()
    +
    doSomething()
     .then(function(result) {
       return doSomethingElse(result);
     })
    @@ -96,7 +96,7 @@ 

    Chaining

    The arguments to then are optional, and catch(failureCallback) is short for then(null, failureCallback). You might see this expressed with arrow functions instead:

    -
    doSomething()
    +
    doSomething()
     .then(result => doSomethingElse(result))
     .then(newResult => doThirdThing(newResult))
     .then(finalResult => {
    @@ -111,7 +111,7 @@ 

    Chaining after a catch

    It's possible to chain after a failure, i.e. a catch, which is useful to accomplish new actions even after an action failed in the chain. Read the following example:

    -
    new Promise((resolve, reject) => {
    +
    new Promise((resolve, reject) => {
         console.log('Initial');
     
         resolve();
    @@ -131,7 +131,7 @@ 

    Chaining after a catch

    This will output the following text:

    -
    Initial
    +
    Initial
     Do that
     Do this, no matter what happened before
     
    @@ -142,7 +142,7 @@

    Error propagation

    You might recall seeing failureCallback three times in the pyramid of doom earlier, compared to only once at the end of the promise chain:

    -
    doSomething()
    +
    doSomething()
     .then(result => doSomethingElse(result))
     .then(newResult => doThirdThing(newResult))
     .then(finalResult => console.log(`Got the final result: ${finalResult}`))
    @@ -151,7 +151,7 @@ 

    Error propagation

    If there's an exception, the browser will look down the chain for .catch() handlers or onRejected. This is very much modeled after how synchronous code works:

    -
    try {
    +
    try {
       const result = syncDoSomething();
       const newResult = syncDoSomethingElse(result);
       const finalResult = syncDoThirdThing(newResult);
    @@ -163,7 +163,7 @@ 

    Error propagation

    This symmetry with asynchronous code culminates in the async/await syntactic sugar in ECMAScript 2017:

    -
    async function foo() {
    +
    async function foo() {
       try {
         const result = await doSomething();
         const newResult = await doSomethingElse(result);
    @@ -196,7 +196,7 @@ 

    Promise rejection events

    One case of special usefulness: when writing code for Node.js, it's common that modules you include in your project may have unhandled rejected promises, logged to the console by the Node.js runtime. You can capture them for analysis and handling by your code—or just to avoid having them cluttering up your output—by adding a handler for the Node.js unhandledRejection event (notice the difference in capitalization of the name), like this:

    -
    process.on("unhandledRejection", (reason, promise) => {
    +
    process.on("unhandledRejection", (reason, promise) => {
       /* You might start here by adding code to examine the
        * "promise" and "reason" values. */
     });
    @@ -212,14 +212,14 @@ 

    Creating a Promise around

    In an ideal world, all asynchronous functions would already return promises. Unfortunately, some APIs still expect success and/or failure callbacks to be passed in the old way. The most obvious example is the setTimeout() function:

    -
    setTimeout(() => saySomething("10 seconds passed"), 10*1000);
    +
    setTimeout(() => saySomething("10 seconds passed"), 10*1000);
     

    Mixing old-style callbacks and promises is problematic. If saySomething() fails or contains a programming error, nothing catches it. setTimeout is to blame for this.

    Luckily we can wrap setTimeout in a promise. Best practice is to wrap problematic functions at the lowest possible level, and then never call them directly again:

    -
    const wait = ms => new Promise(resolve => setTimeout(resolve, ms));
    +
    const wait = ms => new Promise(resolve => setTimeout(resolve, ms));
     
     wait(10*1000).then(() => saySomething("10 seconds")).catch(failureCallback);
     
    @@ -234,13 +234,13 @@

    Composition

    We can start operations in parallel and wait for them all to finish like this:

    -
    Promise.all([func1(), func2(), func3()])
    +
    Promise.all([func1(), func2(), func3()])
     .then(([result1, result2, result3]) => { /* use result1, result2 and result3 */ });
     

    Sequential composition is possible using some clever JavaScript:

    -
    [func1, func2, func3].reduce((p, f) => p.then(f), Promise.resolve())
    +
    [func1, func2, func3].reduce((p, f) => p.then(f), Promise.resolve())
     .then(result3 => { /* use result3 */ });
     
    @@ -248,18 +248,18 @@

    Composition

    This can be made into a reusable compose function, which is common in functional programming:

    -
    const applyAsync = (acc,val) => acc.then(val);
    +
    const applyAsync = (acc,val) => acc.then(val);
     const composeAsync = (...funcs) => x => funcs.reduce(applyAsync, Promise.resolve(x));

    The composeAsync() function will accept any number of functions as arguments, and will return a new function that accepts an initial value to be passed through the composition pipeline:

    -
    const transformData = composeAsync(func1, func2, func3);
    +
    const transformData = composeAsync(func1, func2, func3);
     const result3 = transformData(data);
     

    In ECMAScript 2017, sequential composition can be done more with async/await:

    -
    let result;
    +
    let result;
     for (const f of [func1, func2, func3]) {
       result = await f(result);
     }
    @@ -270,13 +270,13 @@ 

    Timing

    To avoid surprises, functions passed to then() will never be called synchronously, even with an already-resolved promise:

    -
    Promise.resolve().then(() => console.log(2));
    +
    Promise.resolve().then(() => console.log(2));
     console.log(1); // 1, 2
     

    Instead of running immediately, the passed-in function is put on a microtask queue, which means it runs later (only after the function which created it exits, and when the JavaScript execution stack is empty), just before control is returned to the event loop; i.e. pretty soon:

    -
    const wait = ms => new Promise(resolve => setTimeout(resolve, ms));
    +
    const wait = ms => new Promise(resolve => setTimeout(resolve, ms));
     
     wait().then(() => console.log(4));
     Promise.resolve().then(() => console.log(2)).then(() => console.log(3));
    @@ -287,7 +287,7 @@ 

    Task queues vs microtasks

    Promise callbacks are handled as a Microtask whereas setTimeout() callbacks are handled as Task queues.

    -
    const promise = new Promise(function(resolve, reject) {
    +
    const promise = new Promise(function(resolve, reject) {
       console.log("Promise callback");
       resolve();
     }).then(function(result) {
    @@ -303,7 +303,7 @@ 

    Task queues vs microtasks

    The code above will output:

    -
    Promise callback
    +
    Promise callback
     Promise (pending) Promise {<pending>}
     Promise callback (.then)
     event-loop cycle: Promise (fulfilled) Promise {<fulfilled>}
    @@ -316,7 +316,7 @@

    Nesting

    Nesting is a control structure to limit the scope of catch statements. Specifically, a nested catch only catches failures in its scope and below, not errors higher up in the chain outside the nested scope. When used correctly, this gives greater precision in error recovery:

    -
    doSomethingCritical()
    +
    doSomethingCritical()
     .then(result => doSomethingOptional(result)
       .then(optionalResult => doSomethingExtraNice(optionalResult))
       .catch(e => {})) // Ignore if optional stuff fails; proceed.
    @@ -332,7 +332,7 @@ 

    Common mistakes

    Here are some common mistakes to watch out for when composing promise chains. Several of these mistakes manifest in the following example:

    -
    // Bad example! Spot 3 mistakes!
    +
    // Bad example! Spot 3 mistakes!
     
     doSomething().then(function(result) {
       doSomethingElse(result) // Forgot to return promise from inner chain + unnecessary nesting
    @@ -349,7 +349,7 @@ 

    Common mistakes

    A good rule-of-thumb is to always either return or terminate promise chains, and as soon as you get a new promise, return it immediately, to flatten things:

    -
    doSomething()
    +
    doSomething()
     .then(function(result) {
       return doSomethingElse(result);
     })
    diff --git a/files/en-us/web/javascript/guide/working_with_objects/index.html b/files/en-us/web/javascript/guide/working_with_objects/index.html
    index 1d8e46f4780c5db..e17ff9aa71bec4b 100644
    --- a/files/en-us/web/javascript/guide/working_with_objects/index.html
    +++ b/files/en-us/web/javascript/guide/working_with_objects/index.html
    @@ -24,12 +24,12 @@ 

    Objects and properties

    A JavaScript object has properties associated with it. A property of an object can be explained as a variable that is attached to the object. Object properties are basically the same as ordinary JavaScript variables, except for the attachment to objects. The properties of an object define the characteristics of the object. You access the properties of an object with a simple dot-notation:

    -
    objectName.propertyName
    +
    objectName.propertyName
     

    Like all JavaScript variables, both the object name (which could be a normal variable) and property name are case sensitive. You can define a property by assigning it a value. For example, let's create an object named myCar and give it properties named make, model, and year as follows:

    -
    var myCar = new Object();
    +
    var myCar = new Object();
     myCar.make = 'Ford';
     myCar.model = 'Mustang';
     myCar.year = 1969;
    @@ -37,7 +37,7 @@ 

    Objects and properties

    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 = {
    +
    var myCar = {
         make: 'Ford',
         model: 'Mustang',
         year: 1969
    @@ -46,18 +46,18 @@ 

    Objects and properties

    Unassigned properties of an object are {{jsxref("undefined")}} (and not {{jsxref("null")}}).

    -
    myCar.color; // undefined
    +
    myCar.color; // undefined

    Properties of JavaScript objects can also be accessed or set using a bracket notation (for more details see property accessors). Objects are sometimes called associative arrays, since each property is associated with a string value that can be used to access it. So, for example, you could access the properties of the myCar object as follows:

    -
    myCar['make'] = 'Ford';
    +
    myCar['make'] = 'Ford';
     myCar['model'] = 'Mustang';
     myCar['year'] = 1969;
     

    An object property name can be any valid JavaScript string, or anything that can be converted to a string, including the empty string. However, any property name that is not a valid JavaScript identifier (for example, a property name that has a space or a hyphen, or that starts with a number) can only be accessed using the square bracket notation. This notation is also very useful when property names are to be dynamically determined (when the property name is not determined until runtime). Examples are as follows:

    -
    // four variables are created and assigned in a single go,
    +
    // four variables are created and assigned in a single go,
     // separated by commas
     var myObj = new Object(),
         str = 'myString',
    @@ -78,7 +78,7 @@ 

    Objects and properties

    You can also access properties by using a string value that is stored in a variable:

    -
    var propertyName = 'make';
    +
    var propertyName = 'make';
     myCar[propertyName] = 'Ford';
     
     propertyName = 'model';
    @@ -87,7 +87,7 @@ 

    Objects and properties

    You can use the bracket notation with for...in to iterate over all the enumerable properties of an object. To illustrate how this works, the following function displays the properties of the object when you pass the object and the object's name as arguments to the function:

    -
    function showProps(obj, objName) {
    +
    function showProps(obj, objName) {
       var result = ``;
       for (var i in obj) {
         // obj.hasOwnProperty() is used to filter out properties from the object's prototype chain
    @@ -101,7 +101,7 @@ 

    Objects and properties

    So, the function call showProps(myCar, "myCar") would return the following:

    -
    myCar.make = Ford
    +
    myCar.make = Ford
     myCar.model = Mustang
     myCar.year = 1969
    @@ -120,7 +120,7 @@

    Enumerate the properties of an ob

    Before ECMAScript 5, there was no native way to list all properties of an object. However, this can be achieved with the following function:

    -
    function listAllProperties(o) {
    +
    function listAllProperties(o) {
     	var objectToInspect;
     	var result = [];
     
    @@ -147,7 +147,7 @@ 

    Using object i

    The syntax for an object using an object initializer is:

    -
    var obj = { property_1:   value_1,   // property_# may be an identifier...
    +
    var obj = { property_1:   value_1,   // property_# may be an identifier...
                 2:            value_2,   // or a number...
                 // ...,
                 'property n': value_n }; // or a string
    @@ -159,12 +159,12 @@ 

    Using object i

    The following statement creates an object and assigns it to the variable x if and only if the expression cond is true:

    -
    if (cond) var x = {greeting: 'hi there'};
    +
    if (cond) var x = {greeting: 'hi there'};
     

    The following example creates myHonda with three properties. Note that the engine property is also an object with its own properties.

    -
    var myHonda = {color: 'red', wheels: 4, engine: {cylinders: 4, size: 2.2}};
    +
    var myHonda = {color: 'red', wheels: 4, engine: {cylinders: 4, size: 2.2}};
     

    You can also use object initializers to create arrays. See array literals.

    @@ -180,7 +180,7 @@

    Using a constructor function

    To define an object type, create a function for the object type that specifies its name, properties, and methods. For example, suppose you want to create an object type for cars. You want this type of object to be called Car, and you want it to have properties for make, model, and year. To do this, you would write the following function:

    -
    function Car(make, model, year) {
    +
    function Car(make, model, year) {
       this.make = make;
       this.model = model;
       this.year = year;
    @@ -191,20 +191,20 @@ 

    Using a constructor function

    Now you can create an object called mycar as follows:

    -
    var mycar = new Car('Eagle', 'Talon TSi', 1993);
    +
    var mycar = new Car('Eagle', 'Talon TSi', 1993);
     

    This statement creates mycar and assigns it the specified values for its properties. Then the value of mycar.make is the string "Eagle", mycar.year is the integer 1993, and so on.

    You can create any number of Car objects by calls to new. For example,

    -
    var kenscar = new Car('Nissan', '300ZX', 1992);
    +
    var kenscar = new Car('Nissan', '300ZX', 1992);
     var vpgscar = new Car('Mazda', 'Miata', 1990);
     

    An object can have a property that is itself another object. For example, suppose you define an object called person as follows:

    -
    function Person(name, age, sex) {
    +
    function Person(name, age, sex) {
       this.name = name;
       this.age = age;
       this.sex = sex;
    @@ -213,13 +213,13 @@ 

    Using a constructor function

    and then instantiate two new person objects as follows:

    -
    var rand = new Person('Rand McKinnon', 33, 'M');
    +
    var rand = new Person('Rand McKinnon', 33, 'M');
     var ken = new Person('Ken Jones', 39, 'M');
     

    Then, you can rewrite the definition of Car to include an owner property that takes a person object, as follows:

    -
    function Car(make, model, year, owner) {
    +
    function Car(make, model, year, owner) {
       this.make = make;
       this.model = model;
       this.year = year;
    @@ -229,18 +229,18 @@ 

    Using a constructor function

    To instantiate the new objects, you then use the following:

    -
    var car1 = new Car('Eagle', 'Talon TSi', 1993, rand);
    +
    var car1 = new Car('Eagle', 'Talon TSi', 1993, rand);
     var car2 = new Car('Nissan', '300ZX', 1992, ken);
     

    Notice that instead of passing a literal string or integer value when creating the new objects, the above statements pass the objects rand and ken as the arguments for the owners. Then if you want to find out the name of the owner of car2, you can access the following property:

    -
    car2.owner.name
    +
    car2.owner.name
     

    Note that you can always add a property to a previously defined object. For example, the statement

    -
    car1.color = 'black';
    +
    car1.color = 'black';
     

    adds a property color to car1, and assigns it a value of "black." However, this does not affect any other objects. To add the new property to all objects of the same type, you have to add the property to the definition of the Car object type.

    @@ -249,7 +249,7 @@

    Using the Object.create met

    Objects can also be created using the {{jsxref("Object.create()")}} method. This method can be very useful, because it allows you to choose the prototype object for the object you want to create, without having to define a constructor function.

    -
    // Animal properties and method encapsulation
    +
    // Animal properties and method encapsulation
     var Animal = {
       type: 'Invertebrates', // Default value of properties
       displayType: function() {  // Method which will display type of Animal
    @@ -282,7 +282,7 @@ 

    Defining properties for an objec

    You can add a property to a previously defined object type by using the prototype property. This defines a property that is shared by all objects of the specified type, rather than by just one instance of the object. The following code adds a color property to all objects of type Car, and then assigns a value to the color property of the object car1.

    -
    Car.prototype.color = null;
    +
    Car.prototype.color = null;
     car1.color = 'black';
     
    @@ -292,7 +292,7 @@

    Defining methods

    A method is a function associated with an object, or, put differently, a method is a property of an object that is a function. Methods are defined the way normal functions are defined, except that they have to be assigned as the property of an object. See also method definitions for more details. An example is:

    -
    objectName.methodname = functionName;
    +
    objectName.methodname = functionName;
     
     var myObj = {
       myMethod: function(params) {
    @@ -311,12 +311,12 @@ 

    Defining methods

    You can then call the method in the context of the object as follows:

    -
    object.methodname(params);
    +
    object.methodname(params);
     

    You can define methods for an object type by including a method definition in the object constructor function. You could define a function that would format and display the properties of the previously-defined Car objects; for example,

    -
    function displayCar() {
    +
    function displayCar() {
       var result = `A Beautiful ${this.year} ${this.make} ${this.model}`;
       pretty_print(result);
     }
    @@ -326,12 +326,12 @@ 

    Defining methods

    You can make this function a method of Car by adding the statement

    -
    this.displayCar = displayCar;
    +
    this.displayCar = displayCar;
     

    to the object definition. So, the full definition of Car would now look like

    -
    function Car(make, model, year, owner) {
    +
    function Car(make, model, year, owner) {
       this.make = make;
       this.model = model;
       this.year = year;
    @@ -342,7 +342,7 @@ 

    Defining methods

    Then you can call the displayCar method for each of the objects as follows:

    -
    car1.displayCar();
    +
    car1.displayCar();
     car2.displayCar();
     
    @@ -350,7 +350,7 @@

    Using this for object ref

    JavaScript has a special keyword, this, that you can use within a method to refer to the current object. For example, suppose you have 2 objects, Managerand Intern. Each object have their own nameage and job.  In the function sayHi(), notice there is this.name. When added to the 2 objects they can be called and returns the 'Hello, My name is' then adds the name value from that specific object. As shown below. 

    -
    const Manager = {
    +
    const Manager = {
       name: "John",
       age: 27,
       job: "Software Engineer"
    @@ -375,7 +375,7 @@ 

    Using this for object ref

    The this refers to the object that it is in. You can create a new function called howOldAmI()which logs a sentence saying how old the person is. 

    -
    function howOldAmI (){
    +
    function howOldAmI (){
       console.log('I am ' + this.age + ' years old.')
     }
     Manager.howOldAmI = howOldAmI;
    @@ -395,7 +395,7 @@ 

    Defining getters and setters

    When defining getters and setters using object initializers all you need to do is to prefix a getter method with get and a setter method with set. Of course, the getter method must not expect a parameter, while the setter method expects exactly one parameter (the new value to set). For instance:

    -
    var o = {
    +
    var o = {
       a: 7,
       get b() {
         return this.a + 1;
    @@ -423,7 +423,7 @@ 

    Defining getters and setters

    Getters and setters can also be added to an object at any time after creation using the Object.defineProperties method. This method's first parameter is the object on which you want to define the getter or setter. The second parameter is an object whose property names are the getter or setter names, and whose property values are objects for defining the getter or setter functions. Here's an example that defines the same getter and setter used in the previous example:

    -
    var o = { a: 0 };
    +
    var o = { a: 0 };
     
     Object.defineProperties(o, {
         'b': { get: function() { return this.a + 1; } },
    @@ -440,7 +440,7 @@ 

    Deleting properties

    You can remove a non-inherited property by using the delete operator. The following code shows how to remove a property.

    -
    // Creates a new object, myobj, with two properties, a and b.
    +
    // Creates a new object, myobj, with two properties, a and b.
     var myobj = new Object;
     myobj.a = 5;
     myobj.b = 12;
    @@ -452,7 +452,7 @@ 

    Deleting properties

    You can also use delete to delete a global variable if the var keyword was not used to declare the variable:

    -
    g = 17;
    +
    g = 17;
     delete g;
     
    @@ -460,14 +460,14 @@

    Comparing objects

    In JavaScript, objects are a reference type. Two distinct objects are never equal, even if they have the same properties. Only comparing the same object reference with itself yields true.

    -
    // Two variables, two distinct objects with the same properties
    +
    // Two variables, two distinct objects with the same properties
     var fruit = {name: 'apple'};
     var fruitbear = {name: 'apple'};
     
     fruit == fruitbear; // return false
     fruit === fruitbear; // return false
    -
    // Two variables, a single object
    +
    // Two variables, a single object
     var fruit = {name: 'apple'};
     var fruitbear = fruit;  // Assign fruit object reference to fruitbear
     
    diff --git a/files/en-us/web/javascript/inheritance_and_the_prototype_chain/index.html b/files/en-us/web/javascript/inheritance_and_the_prototype_chain/index.html
    index ea59cc6c3393b1f..39e89dca12cdc4e 100644
    --- a/files/en-us/web/javascript/inheritance_and_the_prototype_chain/index.html
    +++ b/files/en-us/web/javascript/inheritance_and_the_prototype_chain/index.html
    @@ -32,7 +32,7 @@ 

    Inheriting properties

    Here is what happens when trying to access a property:

    -
    // Let's create an object o from function f with its own properties a and b:
    +
    // Let's create an object o from function f with its own properties a and b:
     let f = function () {
        this.a = 1;
        this.b = 2;
    @@ -82,7 +82,7 @@ 

    Inheriting "methods"

    When an inherited function is executed, the value of this points to the inheriting object, not to the prototype object where the function is an own property.

    -
    var o = {
    +
    var o = {
       a: 2,
       m: function() {
         return this.a + 1;
    @@ -109,7 +109,7 @@ 

    Using prototypes in JavaScript

    In JavaScript, as mentioned above, functions are able to have properties. All functions have a special property named prototype. Please note that the code below is free-standing (it is safe to assume there is no other JavaScript on the webpage other than the below code). For the best learning experience, it is highly recommended that you open a console, navigate to the "console" tab, copy-and-paste in the below JavaScript code, and run it by pressing the Enter/Return key. (The console is included in most web browser's Developer Tools. More information is available for Firefox Developer Tools, Chrome DevTools, and Edge DevTools.)

    -
    function doSomething(){}
    +
    function doSomething(){}
     console.log( doSomething.prototype );
     //  It does not matter how you declare the function, a
     //  function in JavaScript will always have a default
    @@ -121,7 +121,7 @@ 

    Using prototypes in JavaScript

    As seen above, doSomething() has a default prototype property, as demonstrated by the console. After running this code, the console should have displayed an object that looks similar to this.

    -
    {
    +
    {
         constructor: ƒ doSomething(),
         __proto__: {
             constructor: ƒ Object(),
    @@ -136,13 +136,13 @@ 

    Using prototypes in JavaScript

    We can add properties to the prototype of doSomething(), as shown below.

    -
    function doSomething(){}
    +
    function doSomething(){}
     doSomething.prototype.foo = "bar";
     console.log( doSomething.prototype );

    This results in:

    -
    {
    +
    {
         foo: "bar",
         constructor: ƒ doSomething(),
         __proto__: {
    @@ -161,7 +161,7 @@ 

    Using prototypes in JavaScript

    Try the following code:

    -
    function doSomething(){}
    +
    function doSomething(){}
     doSomething.prototype.foo = "bar"; // add a property onto the prototype
     var doSomeInstancing = new doSomething();
     doSomeInstancing.prop = "some value"; // add a property onto the object
    @@ -169,7 +169,7 @@ 

    Using prototypes in JavaScript

    This results in an output similar to the following:

    -
    {
    +
    {
         prop: "some value",
         __proto__: {
             foo: "bar",
    @@ -196,7 +196,7 @@ 

    Using prototypes in JavaScript

    Let's try entering some more code into the console:

    -
    function doSomething(){}
    +
    function doSomething(){}
     doSomething.prototype.foo = "bar";
     var doSomeInstancing = new doSomething();
     doSomeInstancing.prop = "some value";
    @@ -209,7 +209,7 @@ 

    Using prototypes in JavaScript

    This results in the following:

    -
    doSomeInstancing.prop:      some value
    +
    doSomeInstancing.prop:      some value
     doSomeInstancing.foo:       bar
     doSomething.prop:           undefined
     doSomething.foo:            undefined
    @@ -220,7 +220,7 @@ 

    Diff

    Objects created with syntax constructs

    -
    var o = {a: 1};
    +
    var o = {a: 1};
     
     // The newly created object o has Object.prototype as its [[Prototype]]
     // o has no own property named 'hasOwnProperty'
    @@ -249,7 +249,7 @@ 

    With a constructor

    A "constructor" in JavaScript is "just" a function that happens to be called with the new operator.

    -
    function Graph() {
    +
    function Graph() {
       this.vertices = [];
       this.edges = [];
     }
    @@ -269,7 +269,7 @@ 

    With Object.create

    ECMAScript 5 introduced a new method: {{jsxref("Object.create()")}}. Calling this method creates a new object. The prototype of this object is the first argument of the function:

    -
    var a = {a: 1};
    +
    var a = {a: 1};
     // a ---> Object.prototype ---> null
     
     var b = Object.create(a);
    @@ -289,7 +289,7 @@ 

    delete

    Using Object.create of another object demonstrates prototypical inheritance with the delete operation:

    -
    var a = {a: 1};
    +
    var a = {a: 1};
     
     var b = Object.create(a);
     
    @@ -307,7 +307,7 @@ 

    delete

    The new operator has a shorter chain in this example:

    -
    function Graph() {
    +
    function Graph() {
       this.vertices = [4,4];
     }
     
    @@ -323,7 +323,7 @@ 

    With the class keyword

    ECMAScript 2015 introduced a new set of keywords implementing classes. The new keywords include {{jsxref("Statements/class", "class")}}, {{jsxref("Classes/constructor", "constructor")}}, {{jsxref("Classes/static", "static")}}, {{jsxref("Classes/extends", "extends")}}, and {{jsxref("Operators/super", "super")}}.

    -
    'use strict';
    +
    'use strict';
     
     class Polygon {
       constructor(height, width) {
    @@ -354,7 +354,7 @@ 

    Performance

    Also, when iterating over the properties of an object, every enumerable property that is on the prototype chain will be enumerated. To check whether an object has a property defined on itself and not somewhere on its prototype chain, it is necessary to use the hasOwnProperty method which all objects inherit from Object.prototype. To give you a concrete example, let's take the above graph example code to illustrate it:

    -
    console.log(g.hasOwnProperty('vertices'));
    +
    console.log(g.hasOwnProperty('vertices'));
     // true
     
     console.log(g.hasOwnProperty('nope'));
    @@ -394,7 +394,7 @@ 

    Summary of methods New-initialization -
    +			
     function foo(){}
     foo.prototype = {
       foo_prop: "foo val"
    @@ -414,7 +414,7 @@ 

    Summary of methods Object.create -
    +			
     function foo(){}
     foo.prototype = {
       foo_prop: "foo val"
    @@ -430,7 +430,7 @@ 

    Summary of methods console.log(inst.bar_prop);

    -
    +			
     function foo(){}
     foo.prototype = {
       foo_prop: "foo val"
    @@ -457,7 +457,7 @@ 

    Summary of methods

    Object.setPrototypeOf

    -
    +			
     function foo(){}
     foo.prototype = {
       foo_prop: "foo val"
    @@ -475,7 +475,7 @@ 

    Summary of methods console.log(inst.bar_prop);

    -
    +			
     function foo(){}
     foo.prototype = {
       foo_prop: "foo val"
    @@ -497,7 +497,7 @@ 

    Summary of methods __proto__ -
    +			
     function foo(){}
     foo.prototype = {
       foo_prop: "foo val"
    @@ -513,7 +513,7 @@ 

    Summary of methods console.log(inst.bar_prop);

    -
    +			
     var inst = {
       __proto__: {
         bar_prop: "bar val",
    @@ -546,17 +546,17 @@ 

    prototype and Ob

    So, when you call

    -
    var o = new Foo();
    +
    var o = new Foo();

    JavaScript actually just does

    -
    var o = new Object();
    +
    var o = new Object();
     o.[[Prototype]] = Foo.prototype;
     Foo.call(o);

    (or something like that) and when you later do

    -
    o.someProp;
    +
    o.someProp;

    it checks whether o has a property someProp. If not, it checks Object.getPrototypeOf(o).someProp, and if that doesn't exist it checks Object.getPrototypeOf(Object.getPrototypeOf(o)).someProp, and so on.

    diff --git a/files/en-us/web/javascript/reference/classes/constructor/index.html b/files/en-us/web/javascript/reference/classes/constructor/index.html index 60410caaf5712df..7bf74f00da8689a 100644 --- a/files/en-us/web/javascript/reference/classes/constructor/index.html +++ b/files/en-us/web/javascript/reference/classes/constructor/index.html @@ -17,14 +17,14 @@

    Syntax

    -
    constructor([arguments]) { ... }
    +
    constructor([arguments]) { ... }

    Description

    A constructor enables you to provide any custom initialization that must be done before any other methods can be called on an instantiated object.

    -
    class Person {
    +
    class Person {
     
       constructor(name) {
         this.name = name;
    @@ -43,18 +43,18 @@ 

    Description

    If you don't provide your own constructor, then a default constructor will be supplied for you. If your class is a base class, the default constructor is empty:

    -
    constructor() {}
    +
    constructor() {}

    If your class is a derived class, the default constructor calls the parent constructor, passing along any arguments that were provided:

    -
    constructor(...args) {
    +
    constructor(...args) {
       super(...args);
     }

    That enables code like this to work:

    -
    class ValidationError extends Error {
    +
    class ValidationError extends Error {
     
       printCustomerMessage() {
         return `Validation failed :-( (details: ${this.message})`;
    @@ -82,7 +82,7 @@ 

    Description

    class, then you must explicitly call the parent class constructor using super. For example:

    -
    class ValidationError extends Error {
    +
    class ValidationError extends Error {
     
       constructor(message) {
         super(message);  // call parent class constructor
    @@ -124,7 +124,7 @@ 

    Using the constructor method< href="https://googlechrome.github.io/samples/classes-es6/index.html">live demo).

    -
    class Square extends Polygon {
    +
    class Square extends Polygon {
       constructor(length) {
         // Here, it calls the parent class' constructor with lengths
         // provided for the Polygon's width and height
    @@ -150,7 +150,7 @@ 

    Another example

    base class Polygon is still called when a new instance of a square is created.

    -
    class Polygon {
    +
    class Polygon {
         constructor() {
             this.name = "Polygon";
         }
    diff --git a/files/en-us/web/javascript/reference/classes/extends/index.html b/files/en-us/web/javascript/reference/classes/extends/index.html
    index 51ca1ce17b9b06a..e430176790294a1 100644
    --- a/files/en-us/web/javascript/reference/classes/extends/index.html
    +++ b/files/en-us/web/javascript/reference/classes/extends/index.html
    @@ -24,7 +24,7 @@
     
     

    Syntax

    -
    class ChildClass extends ParentClass { ... }
    +
    class ChildClass extends ParentClass { ... }

    Description

    @@ -44,7 +44,7 @@

    Using extends

    href="https://github.com/GoogleChrome/samples/blob/gh-pages/classes-es6/index.html">(source).

    -
    class Square extends Polygon {
    +
    class Square extends Polygon {
       constructor(length) {
         // Here, it calls the parent class' constructor with lengths
         // provided for the Polygon's width and height
    @@ -67,7 +67,7 @@ 

    Using extends with built-in objects href="https://github.com/GoogleChrome/samples/blob/gh-pages/classes-es6/index.html">(source).

    -
    class myDate extends Date {
    +
    class myDate extends Date {
     
       getFormattedDate() {
         var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
    diff --git a/files/en-us/web/javascript/reference/classes/index.html b/files/en-us/web/javascript/reference/classes/index.html
    index bb453e8a573a4ff..b9e3d0cb74d588f 100644
    --- a/files/en-us/web/javascript/reference/classes/index.html
    +++ b/files/en-us/web/javascript/reference/classes/index.html
    @@ -22,7 +22,7 @@ 

    Class declarations

    One way to define a class is using a class declaration. To declare a class, you use the class keyword with the name of the class ("Rectangle" here).

    -
    class Rectangle {
    +
    class Rectangle {
       constructor(height, width) {
         this.height = height;
         this.width = width;
    @@ -33,7 +33,7 @@ 

    Hoisting

    An important difference between function declarations and class declarations is that function declarations are {{Glossary("Hoisting", "hoisted")}} and class declarations are not. You first need to declare your class and then access it, otherwise code like the following will throw a {{jsxref("ReferenceError")}}:

    -
    const p = new Rectangle(); // ReferenceError
    +
    const p = new Rectangle(); // ReferenceError
     
     class Rectangle {}
     
    @@ -42,7 +42,7 @@

    Class expressions

    A class expression is another way to define a class. Class expressions can be named or unnamed. The name given to a named class expression is local to the class's body. (it can be retrieved through the class's (not an instance's) {{jsxref("Function.name", "name")}} property, though).

    -
    // unnamed
    +
    // unnamed
     let Rectangle = class {
       constructor(height, width) {
         this.height = height;
    @@ -86,7 +86,7 @@ 

    Prototype methods

    See also {{jsxref("Functions/Method_definitions", "method definitions", "", "true")}}.

    -
    class Rectangle {
    +
    class Rectangle {
       constructor(height, width) {
         this.height = height;
         this.width = width;
    @@ -109,7 +109,7 @@ 

    Generator methods

    See also Iterators and generators.

    -
    class Polygon {
    +
    class Polygon {
       constructor(...sides) {
         this.sides = sides;
       }
    @@ -129,7 +129,7 @@ 

    Static methods and properties

    The {{jsxref("Classes/static", "static", "", "true")}} keyword defines a static method or property for a class. Static members (properties and methods) are called without instantiating their class and cannot be called through a class instance. Static methods are often used to create utility functions for an application, whereas static properties are useful for caches, fixed-configuration, or any other data you don't need to be replicated across instances.

    -
    class Point {
    +
    class Point {
       constructor(x, y) {
         this.x = x;
         this.y = y;
    @@ -159,7 +159,7 @@ 

    Binding thisWhen a static or prototype method is called without a value for {{jsxref("Operators/this", "this")}}, such as by assigning the method to a variable and then calling it, the this value will be undefined inside the method. This behavior will be the same even if the {{jsxref("Strict_mode", "\"use strict\"")}} directive isn't present, because code within the class body's syntactic boundary is always executed in strict mode.

    -
    class Animal {
    +
    class Animal {
       speak() {
         return this;
       }
    @@ -179,7 +179,7 @@ 

    Binding thisIf we rewrite the above using traditional function-based syntax in non–strict mode, then this method calls are automatically bound to the initial this value, which by default is the {{Glossary("Global_object", "global object")}}. In strict mode, autobinding will not happen; the value of this remains as passed.

    -
    function Animal() { }
    +
    function Animal() { }
     
     Animal.prototype.speak = function() {
       return this;
    @@ -201,7 +201,7 @@ 

    Instance properties

    Instance properties must be defined inside of class methods:

    -
    class Rectangle {
    +
    class Rectangle {
       constructor(height, width) {
         this.height = height;
         this.width = width;
    @@ -210,7 +210,7 @@ 

    Instance properties

    Static (class-side) data properties and prototype data properties must be defined outside of the ClassBody declaration:

    -
    Rectangle.staticWidth = 20;
    +
    Rectangle.staticWidth = 20;
     Rectangle.prototype.prototypeWidth = 25;
     
    @@ -224,7 +224,7 @@

    Public field declarations

    With the JavaScript field declaration syntax, the above example can be written as:

    -
    class Rectangle {
    +
    class Rectangle {
       height = 0;
       width;
       constructor(height, width) {
    @@ -244,7 +244,7 @@ 

    Private field declarations

    Using private fields, the definition can be refined as below.

    -
    class Rectangle {
    +
    class Rectangle {
       #height = 0;
       #width;
       constructor(height, width) {
    @@ -269,7 +269,7 @@ 

    Sub classing with extends

    The {{jsxref("Classes/extends", "extends")}} keyword is used in class declarations or class expressions to create a class as a child of another class.

    -
    class Animal {
    +
    class Animal {
       constructor(name) {
         this.name = name;
       }
    @@ -297,7 +297,7 @@ 

    Sub classing with extends

    One may also extend traditional function-based "classes":

    -
    function Animal (name) {
    +
    function Animal (name) {
       this.name = name;
     }
     
    @@ -318,7 +318,7 @@ 

    Sub classing with extends

    Note that classes cannot extend regular (non-constructible) objects. If you want to inherit from a regular object, you can instead use {{jsxref("Object.setPrototypeOf()")}}:

    -
    const Animal = {
    +
    const Animal = {
       speak() {
         console.log(`${this.name} makes a noise.`);
       }
    @@ -343,7 +343,7 @@ 

    Species

    For example, when using methods such as {{jsxref("Array.map", "map()")}} that returns the default constructor, you want these methods to return a parent Array object, instead of the MyArray object. The {{jsxref("Symbol.species")}} symbol lets you do this:

    -
    class MyArray extends Array {
    +
    class MyArray extends Array {
       // Overwrite species to the parent Array constructor
       static get [Symbol.species]() { return Array; }
     }
    @@ -359,7 +359,7 @@ 

    Super class calls with super<

    The {{jsxref("Operators/super", "super")}} keyword is used to call corresponding methods of super class. This is one advantage over prototype-based inheritance.

    -
    class Cat {
    +
    class Cat {
       constructor(name) {
         this.name = name;
       }
    @@ -388,7 +388,7 @@ 

    Mix-ins

    A function with a superclass as input and a subclass extending that superclass as output can be used to implement mix-ins in ECMAScript:

    -
    let calculatorMixin = Base => class extends Base {
    +
    let calculatorMixin = Base => class extends Base {
       calc() { }
     };
     
    @@ -399,7 +399,7 @@ 

    Mix-ins

    A class that uses these mix-ins can then be written like this:

    -
    class Foo { }
    +
    class Foo { }
     class Bar extends calculatorMixin(randomizerMixin(Foo)) { }

    Re-running a class definition

    diff --git a/files/en-us/web/javascript/reference/classes/private_class_fields/index.html b/files/en-us/web/javascript/reference/classes/private_class_fields/index.html index 1e2a40ac898eb7e..2557edb32a7d709 100644 --- a/files/en-us/web/javascript/reference/classes/private_class_fields/index.html +++ b/files/en-us/web/javascript/reference/classes/private_class_fields/index.html @@ -15,7 +15,7 @@

    Syntax

    -
    class ClassWithPrivateField {
    +
    class ClassWithPrivateField {
       #privateField
     }
     
    @@ -39,7 +39,7 @@ 

    Private static fields

    The limitation of static variables being called by only static methods still holds.

    -
    class ClassWithPrivateStaticField {
    +
    class ClassWithPrivateStaticField {
       static #PRIVATE_STATIC_FIELD
     
       static publicStaticMethod() {
    @@ -57,7 +57,7 @@ 

    Private static fields

    This can lead to unexpected behavior when using this.

    -
    class BaseClassWithPrivateStaticField {
    +
    class BaseClassWithPrivateStaticField {
       static #PRIVATE_STATIC_FIELD
     
       static basePublicStaticMethod() {
    @@ -87,7 +87,7 @@ 

    Private instance fields

    The encapsulation is enforced by the language. It is a syntax error to refer to # names from out of scope.

    -
    class ClassWithPrivateField {
    +
    class ClassWithPrivateField {
       #privateField
     
       constructor() {
    @@ -110,7 +110,7 @@ 

    Private static methods

    Private static methods may be generator, async, and async generator functions.

    -
    class ClassWithPrivateStaticMethod {
    +
    class ClassWithPrivateStaticMethod {
       static #privateStaticMethod() {
         return 42
       }
    @@ -134,7 +134,7 @@ 

    Private static methods

    Derived.publicStaticMethod2(), and thus exhibits the same "provenance restriction" as mentioned above:

    -
    class Base {
    +
    class Base {
       static #privateStaticMethod() {
         return 42;
       }
    @@ -157,7 +157,7 @@ 

    Private instance methods

    Private instance methods are methods available on class instances whose access is restricted in the same manner as private instance fields.

    -
    class ClassWithPrivateMethod {
    +
    class ClassWithPrivateMethod {
       #privateMethod() {
         return 'hello world'
       }
    @@ -174,7 +174,7 @@ 

    Private instance methods

    Private instance methods may be generator, async, or async generator functions. Private getters and setters are also possible:

    -
    class ClassWithPrivateAccessor {
    +
    class ClassWithPrivateAccessor {
       #message
     
       get #decoratedMessage() {
    diff --git a/files/en-us/web/javascript/reference/classes/public_class_fields/index.html b/files/en-us/web/javascript/reference/classes/public_class_fields/index.html
    index d9f761ff2ddb94c..71a5b02014e81e6 100644
    --- a/files/en-us/web/javascript/reference/classes/public_class_fields/index.html
    +++ b/files/en-us/web/javascript/reference/classes/public_class_fields/index.html
    @@ -27,7 +27,7 @@
     
     

    Syntax

    -
    class ClassWithInstanceField {
    +
    class ClassWithInstanceField {
       instanceField = 'instance field'
     }
     
    diff --git a/files/en-us/web/javascript/reference/classes/static/index.html b/files/en-us/web/javascript/reference/classes/static/index.html
    index 6dae6b84670f70d..328c639c91ca127 100644
    --- a/files/en-us/web/javascript/reference/classes/static/index.html
    +++ b/files/en-us/web/javascript/reference/classes/static/index.html
    @@ -27,7 +27,7 @@
     
     

    Syntax

    -
    static methodName() { ... }
    +
    static methodName() { ... }
     static propertyName [= value];
     
    @@ -43,7 +43,7 @@

    Using static members in classes

  • How a static member can and cannot be called.
  • -
    class Triple {
    +
    class Triple {
       static customName = 'Tripler';
       static description = 'I triple any number you provide';
       static triple(n = 1) {
    @@ -81,7 +81,7 @@ 

    Calling static member this keyword.

    -
    class StaticMethodCall {
    +
    class StaticMethodCall {
       static staticProperty = 'static property';
       static staticMethod() {
         return 'Static method and ' + this.staticProperty + ' has been called';
    @@ -106,7 +106,7 @@ 

    Calli the constructor: this.constructor.STATIC_METHOD_NAME() / this.constructor.STATIC_PROPERTY_NAME

    -
    class StaticMethodCall {
    +
    class StaticMethodCall {
       constructor() {
         console.log(StaticMethodCall.staticProperty); // 'static property'
         console.log(this.constructor.staticProperty); // 'static property'
    diff --git a/files/en-us/web/javascript/reference/global_objects/aggregateerror/aggregateerror/index.html b/files/en-us/web/javascript/reference/global_objects/aggregateerror/aggregateerror/index.html
    index cf5ceff0d7ee753..360fdc5a0b3143d 100644
    --- a/files/en-us/web/javascript/reference/global_objects/aggregateerror/aggregateerror/index.html
    +++ b/files/en-us/web/javascript/reference/global_objects/aggregateerror/aggregateerror/index.html
    @@ -13,7 +13,7 @@
     
     

    Syntax

    -
    new AggregateError(errors[, message])
    +
    new AggregateError(errors[, message])

    Parameters

    diff --git a/files/en-us/web/javascript/reference/global_objects/aggregateerror/index.html b/files/en-us/web/javascript/reference/global_objects/aggregateerror/index.html index e95a67b6a4b40d9..d5c4921beedc382 100644 --- a/files/en-us/web/javascript/reference/global_objects/aggregateerror/index.html +++ b/files/en-us/web/javascript/reference/global_objects/aggregateerror/index.html @@ -31,7 +31,7 @@

    Examples

    Catching an AggregateError

    -
    Promise.any([
    +
    Promise.any([
       Promise.reject(new Error("some error")),
     ]).catch(e => {
       console.log(e instanceof AggregateError); // true
    @@ -43,7 +43,7 @@ 

    Catching an AggregateError

    Creating an AggregateError

    -
    try {
    +
    try {
       throw new AggregateError([
         new Error("some error"),
       ], 'Hello');
    diff --git a/files/en-us/web/javascript/reference/global_objects/array/@@iterator/index.html b/files/en-us/web/javascript/reference/global_objects/array/@@iterator/index.html
    index 3457e54efb53cb7..22fb90858cb1bac 100644
    --- a/files/en-us/web/javascript/reference/global_objects/array/@@iterator/index.html
    +++ b/files/en-us/web/javascript/reference/global_objects/array/@@iterator/index.html
    @@ -24,7 +24,7 @@
     
     

    Syntax

    -
    arr[Symbol.iterator]()
    +
    arr[Symbol.iterator]()

    Return value

    @@ -38,12 +38,12 @@

    Iteration using for...of loop

    HTML

    -
    <ul id="letterResult">
    +
    <ul id="letterResult">
     </ul>

    JavaScript

    -
    const arr = ['a', 'b', 'c'];
    +
    const arr = ['a', 'b', 'c'];
     const eArr = arr[Symbol.iterator]();
     const letterResult = document.getElementById('letterResult');
     // your browser must support for..of loop
    @@ -63,7 +63,7 @@ 

    Result

    Alternative iteration

    -
    var arr = ['a', 'b', 'c', 'd', 'e'];
    +
    var arr = ['a', 'b', 'c', 'd', 'e'];
     var eArr = arr[Symbol.iterator]();
     console.log(eArr.next().value); // a
     console.log(eArr.next().value); // b
    @@ -82,7 +82,7 @@ 

    Use Case for brace notation

    href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/@@iterator">String object or a custom object.

    -
    function logIterable(it) {
    +
    function logIterable(it) {
      if (!(Symbol.iterator in Object.getPrototypeOf(it)
      /* or "Symbol.iterator in Object.__proto__"
         or "it[Symbol.iterator]" */)) {
    diff --git a/files/en-us/web/javascript/reference/global_objects/array/@@species/index.html b/files/en-us/web/javascript/reference/global_objects/array/@@species/index.html
    index 6e321f57a015a51..15eaf1cef9075a8 100644
    --- a/files/en-us/web/javascript/reference/global_objects/array/@@species/index.html
    +++ b/files/en-us/web/javascript/reference/global_objects/array/@@species/index.html
    @@ -14,7 +14,7 @@
     
     

    Syntax

    -
    Array[Symbol.species]
    +
    Array[Symbol.species]
     

    Return value

    @@ -34,7 +34,7 @@

    Species in ordinary objects

    The species property returns the default constructor function, which is the Array constructor for Array objects:

    -
    Array[Symbol.species]; // function Array()
    +
    Array[Symbol.species]; // function Array()

    Species in derived objects

    @@ -43,7 +43,7 @@

    Species in derived objects

    want to overwrite this, in order to return parent Array objects in your derived class methods:

    -
    class MyArray extends Array {
    +
    class MyArray extends Array {
       // Overwrite MyArray species to the parent Array constructor
       static get [Symbol.species]() { return Array; }
     }
    diff --git a/files/en-us/web/javascript/reference/global_objects/array/@@unscopables/index.html b/files/en-us/web/javascript/reference/global_objects/array/@@unscopables/index.html index 6fe5ec94c3c20cf..7b13d805b1348e3 100644 --- a/files/en-us/web/javascript/reference/global_objects/array/@@unscopables/index.html +++ b/files/en-us/web/javascript/reference/global_objects/array/@@unscopables/index.html @@ -38,7 +38,7 @@

    Use in with environments

    The following code works fine in ES5 and below. However, in ECMAScript 2015 and later, the {{jsxref("Array.prototype.keys()")}} method was introduced. That means that inside with environments, "keys" would now be the method and not the variable. This is where now the built-in @@unscopables Array.prototype[@@unscopables] symbol property comes into play and prevents that some of the Array methods are being scoped into the with statement.

    -
    var keys = [];
    +
    var keys = [];
     
     with (Array.prototype) {
       keys.push('something');
    diff --git a/files/en-us/web/javascript/reference/global_objects/array/array/index.html b/files/en-us/web/javascript/reference/global_objects/array/array/index.html
    index 2c5a4cb345be1de..cf11e7059e8e5d1 100644
    --- a/files/en-us/web/javascript/reference/global_objects/array/array/index.html
    +++ b/files/en-us/web/javascript/reference/global_objects/array/array/index.html
    @@ -14,7 +14,7 @@
     
     

    Syntax

    -
    [element0, element1, ..., elementN]
    +
    [element0, element1, ..., elementN]
     
     new Array(element0, element1[, ...[, elementN]])
     new Array(arrayLength)
    diff --git a/files/en-us/web/javascript/reference/global_objects/array/at/index.html b/files/en-us/web/javascript/reference/global_objects/array/at/index.html index 58ccbb3a42f4e83..78750dbe2962c25 100644 --- a/files/en-us/web/javascript/reference/global_objects/array/at/index.html +++ b/files/en-us/web/javascript/reference/global_objects/array/at/index.html @@ -21,7 +21,7 @@

    Syntax

    -
    arr.at(index)
    +
    arr.at(index)

    Parameters

    @@ -41,7 +41,7 @@

    Return the last value of an array

    The following example provides a function which returns the last element found in a specified array.

    -
    +
     // Our array with items
     const cart = ['apple', 'banana', 'pear'];
     
    @@ -64,7 +64,7 @@ 

    Comparing methods

    Here we compare different ways to select the penultimate (last but one) item of an {{jsxref('Array')}}. Whilst all below methods are valid, it highlights the succinctness and readability of the at() method.

    -
    +
     // Our array with items
     const colors = ['red', 'green', 'blue'];
     
    diff --git a/files/en-us/web/javascript/reference/global_objects/array/concat/index.html b/files/en-us/web/javascript/reference/global_objects/array/concat/index.html
    index 987777d272e1017..d3077fa8dd90676 100644
    --- a/files/en-us/web/javascript/reference/global_objects/array/concat/index.html
    +++ b/files/en-us/web/javascript/reference/global_objects/array/concat/index.html
    @@ -20,7 +20,7 @@
     

    Syntax

    const new_array = old_array.concat([value1[, value2[, ...[, valueN]]]])
    + class="brush: js">const new_array = old_array.concat([value1[, value2[, ...[, valueN]]]])

    Parameters

    diff --git a/files/en-us/web/javascript/reference/global_objects/array/copywithin/index.html b/files/en-us/web/javascript/reference/global_objects/array/copywithin/index.html index aa4b8fd19847fc1..a3b734ddfd153c2 100644 --- a/files/en-us/web/javascript/reference/global_objects/array/copywithin/index.html +++ b/files/en-us/web/javascript/reference/global_objects/array/copywithin/index.html @@ -19,7 +19,7 @@

    Syntax

    -
    arr.copyWithin(target[, start[, end]])
    +
    arr.copyWithin(target[, start[, end]])
     

    Parameters

    @@ -65,7 +65,7 @@

    Description

    Polyfill

    -
    if (!Array.prototype.copyWithin) {
    +
    if (!Array.prototype.copyWithin) {
       Object.defineProperty(Array.prototype, 'copyWithin', {
         value: function(target, start/*, end*/) {
         // Steps 1-2.
    @@ -137,7 +137,7 @@ 

    Examples

    Using copyWithin

    -
    [1, 2, 3, 4, 5].copyWithin(-2)
    +
    [1, 2, 3, 4, 5].copyWithin(-2)
     // [1, 2, 3, 1, 2]
     
     [1, 2, 3, 4, 5].copyWithin(0, 3)
    diff --git a/files/en-us/web/javascript/reference/global_objects/array/entries/index.html b/files/en-us/web/javascript/reference/global_objects/array/entries/index.html
    index 0828c85d9b94d9f..e00fe85b11dc330 100644
    --- a/files/en-us/web/javascript/reference/global_objects/array/entries/index.html
    +++ b/files/en-us/web/javascript/reference/global_objects/array/entries/index.html
    @@ -19,7 +19,7 @@
     
     

    Syntax

    -
    arr.entries()
    +
    arr.entries()

    Return value

    @@ -29,7 +29,7 @@

    Examples

    Iterating with index and element

    -
    const a = ['a', 'b', 'c'];
    +
    const a = ['a', 'b', 'c'];
     
     for (const [index, element] of a.entries())
       console.log(index, element);
    @@ -42,7 +42,7 @@ 

    Iterating with index and element

    Using a for…of loop

    -
    var a = ['a', 'b', 'c'];
    +
    var a = ['a', 'b', 'c'];
     var iterator = a.entries();
     
     for (let e of iterator) {
    diff --git a/files/en-us/web/javascript/reference/global_objects/array/every/index.html b/files/en-us/web/javascript/reference/global_objects/array/every/index.html
    index 3a45659fe6c2ee6..7e02931fb6ef17f 100644
    --- a/files/en-us/web/javascript/reference/global_objects/array/every/index.html
    +++ b/files/en-us/web/javascript/reference/global_objects/array/every/index.html
    @@ -20,7 +20,7 @@
     

    Syntax

    arr.every(callback(element[, index[, array]])[, thisArg])
    + class="brush: js">arr.every(callback(element[, index[, array]])[, thisArg])

    Parameters

    @@ -103,7 +103,7 @@

    Polyfill

    that callbackfn.call evaluates to the original value of {{jsxref("Function.prototype.call")}}.

    -
    if (!Array.prototype.every) {
    +
    if (!Array.prototype.every) {
       Array.prototype.every = function(callbackfn, thisArg) {
         'use strict';
         var T, k;
    @@ -176,7 +176,7 @@ 

    Testing size of all array elementsThe following example tests whether all elements in the array are bigger than 10.

    -
    function isBigEnough(element, index, array) {
    +
    function isBigEnough(element, index, array) {
       return element >= 10;
     }
     [12, 5, 8, 130, 44].every(isBigEnough);   // false
    @@ -188,7 +188,7 @@ 

    Using arrow functions

    Arrow functions provide a shorter syntax for the same test.

    -
    [12, 5, 8, 130, 44].every(x => x >= 10);   // false
    +
    [12, 5, 8, 130, 44].every(x => x >= 10);   // false
     [12, 54, 18, 130, 44].every(x => x >= 10); // true

    Affecting Initial Array @@ -197,7 +197,7 @@

    Affecting Init

    The following examples tests the behavior of the every method when the array is modified.

    -
    // ---------------
    +
    // ---------------
     // Modifying items
     // ---------------
     let arr = [1, 2, 3, 4];
    diff --git a/files/en-us/web/javascript/reference/global_objects/array/fill/index.html b/files/en-us/web/javascript/reference/global_objects/array/fill/index.html
    index 6093edc4b35205c..4f96de890cbb84a 100644
    --- a/files/en-us/web/javascript/reference/global_objects/array/fill/index.html
    +++ b/files/en-us/web/javascript/reference/global_objects/array/fill/index.html
    @@ -20,7 +20,7 @@
     
     

    Syntax

    -
    arr.fill(value[, start[, end]])
    +
    arr.fill(value[, start[, end]])
     

    Parameters

    @@ -50,7 +50,7 @@

    Description

    Polyfill

    -
    if (!Array.prototype.fill) {
    +
    if (!Array.prototype.fill) {
       Object.defineProperty(Array.prototype, 'fill', {
         value: function(value) {
     
    @@ -102,7 +102,7 @@ 

    Examples

    Using fill

    -
    [1, 2, 3].fill(4)                // [4, 4, 4]
    +
    [1, 2, 3].fill(4)                // [4, 4, 4]
     [1, 2, 3].fill(4, 1)             // [1, 4, 4]
     [1, 2, 3].fill(4, 1, 2)          // [1, 4, 3]
     [1, 2, 3].fill(4, 1, 1)          // [1, 2, 3]
    @@ -122,7 +122,7 @@ 

    Using fill() to create a matrix

    This example shows how to create a matrix of all 1, like the ones() function of Octave or MATLAB.

    -
    const arr = new Array(3);
    +
    const arr = new Array(3);
     for (let i=0; i<arr.length; i++) {
       arr[i] = new Array(4).fill(1); // Creating an array of size 4 and filled of 1
     }
    diff --git a/files/en-us/web/javascript/reference/global_objects/array/filter/index.html b/files/en-us/web/javascript/reference/global_objects/array/filter/index.html
    index c82e8a55dff3f04..4b6cbc46b72281e 100644
    --- a/files/en-us/web/javascript/reference/global_objects/array/filter/index.html
    +++ b/files/en-us/web/javascript/reference/global_objects/array/filter/index.html
    @@ -20,7 +20,7 @@
     
     

    Syntax

    -
    let newArray = arr.filter(callback(currentValue[, index[, array]]) {
    +
    let newArray = arr.filter(callback(currentValue[, index[, array]]) {
       // return element for newArray, if true
     }[, thisArg]);
     
    @@ -75,7 +75,7 @@

    Polyfill

    You can work around this by inserting the following code at the beginning of your scripts, allowing use of filter() in ECMA-262 implementations which do not natively support it. This algorithm is exactly equivalent to the one specified in ECMA-262, 5th edition, assuming that fn.call evaluates to the original value of {{jsxref("Function.prototype.bind()")}}, and that {{jsxref("Array.prototype.push()")}} has its original value.

    -
    if (!Array.prototype.filter){
    +
    if (!Array.prototype.filter){
       Array.prototype.filter = function(func, thisArg) {
         'use strict';
         if ( ! ((typeof func === 'Function' || typeof func === 'function') && this) )
    @@ -120,7 +120,7 @@ 

    Filtering out all small values

    The following example uses filter() to create a filtered array that has all elements with values less than 10 removed.

    -
    function isBigEnough(value) {
    +
    function isBigEnough(value) {
       return value >= 10
     }
     
    @@ -132,7 +132,7 @@ 

    Find all prime numbers in an arrayThe following example returns all prime numbers in the array:

    -
    const array = [-3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13];
    +
    const array = [-3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13];
     
     function isPrime(num) {
       for (let i = 2; num > i; i++) {
    @@ -149,7 +149,7 @@ 

    Filtering invalid entries from JSON

    The following example uses filter() to create a filtered json of all elements with non-zero, numeric id.

    -
    let arr = [
    +
    let arr = [
       { id: 15 },
       { id: -1 },
       { id: 0 },
    @@ -185,7 +185,7 @@ 

    Searching in array

    Following example uses filter() to filter array content based on search criteria.

    -
    let fruits = ['apple', 'banana', 'grapes', 'mango', 'orange']
    +
    let fruits = ['apple', 'banana', 'grapes', 'mango', 'orange']
     
     /**
      * Filter array items based on search criteria (query)
    @@ -201,7 +201,7 @@ 

    Searching in array

    ES2015 Implementation

    -
    const fruits = ['apple', 'banana', 'grapes', 'mango', 'orange']
    +
    const fruits = ['apple', 'banana', 'grapes', 'mango', 'orange']
     
     /**
      * Filter array items based on search criteria (query)
    @@ -219,7 +219,7 @@ 

    Affecting Init

    The following examples tests the behavior of the filter method when the array is modified.

    -
    // Modifying each words
    +
    // Modifying each words
     let words = ['spray', 'limit', 'exuberant', 'destruction','elite', 'present']
     
     const modifiedWords = words.filter( (word, index, arr) => {
    diff --git a/files/en-us/web/javascript/reference/global_objects/array/find/index.html b/files/en-us/web/javascript/reference/global_objects/array/find/index.html
    index c6da1a26a9f8d28..8ceb1b5342b0e49 100644
    --- a/files/en-us/web/javascript/reference/global_objects/array/find/index.html
    +++ b/files/en-us/web/javascript/reference/global_objects/array/find/index.html
    @@ -35,7 +35,7 @@
     

    Syntax

    arr.find(callback(element[, index[, array]])[, thisArg])
    + class="brush: js">arr.find(callback(element[, index[, array]])[, thisArg])

    Parameters

    @@ -102,7 +102,7 @@

    Polyfill

    available in all JavaScript implementations yet. However, you can polyfill Array.prototype.find with the following snippet:

    -
    // https://tc39.github.io/ecma262/#sec-array.prototype.find
    +
    // https://tc39.github.io/ecma262/#sec-array.prototype.find
     if (!Array.prototype.find) {
       Object.defineProperty(Array.prototype, 'find', {
         value: function(predicate) {
    @@ -160,7 +160,7 @@ 

    Examples

    Find an object in an array by one of its properties

    -
    const inventory = [
    +
    const inventory = [
       {name: 'apples', quantity: 2},
       {name: 'bananas', quantity: 0},
       {name: 'cherries', quantity: 5}
    @@ -176,7 +176,7 @@ 

    Find an object in a

    Using arrow function and destructuring

    -
    const inventory = [
    +
    const inventory = [
       {name: 'apples', quantity: 2},
       {name: 'bananas', quantity: 0},
       {name: 'cherries', quantity: 5}
    @@ -191,7 +191,7 @@ 

    Find a prime number in an array

    The following example finds an element in the array that is a prime number (or returns {{jsxref("undefined")}} if there is no prime number):

    -
    function isPrime(element, index, array) {
    +
    function isPrime(element, index, array) {
       let start = 2;
       while (start <= Math.sqrt(element)) {
         if (element % start++ < 1) {
    @@ -208,7 +208,7 @@ 

    Find a prime number in an array

    The following examples show that nonexistent and deleted elements are visited, and that the value passed to the callback is their value when visited:

    -
    // Declare array with no elements at indexes 2, 3, and 4
    +
    // Declare array with no elements at indexes 2, 3, and 4
     const array = [0,1,,,,5,6];
     
     // Shows all indexes, not just those with assigned values
    diff --git a/files/en-us/web/javascript/reference/global_objects/array/findindex/index.html b/files/en-us/web/javascript/reference/global_objects/array/findindex/index.html
    index 70dc8d30109d986..f9c270a69ed5e47 100644
    --- a/files/en-us/web/javascript/reference/global_objects/array/findindex/index.html
    +++ b/files/en-us/web/javascript/reference/global_objects/array/findindex/index.html
    @@ -30,7 +30,7 @@
     
     

    Syntax

    -
    arr.findIndex(callback( element[, index[, array]] )[, thisArg])
    +
    arr.findIndex(callback( element[, index[, array]] )[, thisArg])
     

    Parameters

    diff --git a/files/en-us/web/javascript/reference/global_objects/array/flat/index.html b/files/en-us/web/javascript/reference/global_objects/array/flat/index.html index b64ceb1d410f48f..b7827f89fb0341d 100644 --- a/files/en-us/web/javascript/reference/global_objects/array/flat/index.html +++ b/files/en-us/web/javascript/reference/global_objects/array/flat/index.html @@ -37,7 +37,7 @@

    Alternatives

    reduce and concat

    -
    const arr = [1, 2, [3, 4]];
    +
    const arr = [1, 2, [3, 4]];
     
     // To flat single level array
     arr.flat();
    @@ -51,7 +51,7 @@ 

    reduce and concat

    reduce + concat + isArray + recursivity

    -
    const arr = [1, 2, [3, 4, [5, 6]]];
    +
    const arr = [1, 2, [3, 4, [5, 6]]];
     
     // to enable deep level flatten use recursion with reduce and concat
     function flatDeep(arr, d = 1) {
    @@ -65,7 +65,7 @@ 

    reduce + concat + isArray + recursivi

    Use a stack

    -
    // non recursive flatten deep using a stack
    +
    // non recursive flatten deep using a stack
     // note that depth control is hard/inefficient as we will need to tag EACH value with its own depth
     // also possible w/o reversing on shift/unshift, but array OPs on the end tends to be faster
     function flatten(input) {
    @@ -92,7 +92,7 @@ 

    Use a stack

    Use Generator function

    -
    function* flatten(array, depth) {
    +
    function* flatten(array, depth) {
         if(depth === undefined) {
           depth = 1;
         }
    @@ -120,7 +120,7 @@ 

    Examples

    Flattening nested arrays

    -
    const arr1 = [1, 2, [3, 4]];
    +
    const arr1 = [1, 2, [3, 4]];
     arr1.flat();
     // [1, 2, 3, 4]
     
    @@ -141,7 +141,7 @@ 

    Flattening and array holes

    The flat method removes empty slots in arrays:

    -
    const arr5 = [1, 2, , 4, 5];
    +
    const arr5 = [1, 2, , 4, 5];
     arr5.flat();
     // [1, 2, 4, 5]
     
    diff --git a/files/en-us/web/javascript/reference/global_objects/array/flatmap/index.html b/files/en-us/web/javascript/reference/global_objects/array/flatmap/index.html index f35e758d126c363..2f9eedd82ef20f6 100644 --- a/files/en-us/web/javascript/reference/global_objects/array/flatmap/index.html +++ b/files/en-us/web/javascript/reference/global_objects/array/flatmap/index.html @@ -20,7 +20,7 @@

    Syntax

    -
    var new_array = arr.flatMap(function callback(currentValue[, index[, array]]) {
    +
    var new_array = arr.flatMap(function callback(currentValue[, index[, array]]) {
         // return element for new_array
     }[, thisArg])
    @@ -60,7 +60,7 @@

    Alternative

    reduce() and concat()

    -
    var arr = [1, 2, 3, 4];
    +
    var arr = [1, 2, 3, 4];
     
     arr.flatMap(x => [x, x * 2]);
     // is equivalent to
    @@ -83,7 +83,7 @@ 

    Examples

    map() and flatMap()

    -
    let arr1 = [1, 2, 3, 4];
    +
    let arr1 = [1, 2, 3, 4];
     
     arr1.map(x => [x * 2]);
     // [[2], [4], [6], [8]]
    @@ -101,7 +101,7 @@ 

    map() and flatMap()

    Let's generate a list of words from a list of sentences.

    -
    let arr1 = ["it's Sunny in", "", "California"];
    +
    let arr1 = ["it's Sunny in", "", "California"];
     
     arr1.map(x => x.split(" "));
     // [["it's","Sunny","in"],[""],["California"]]
    @@ -122,7 +122,7 @@ 

    For adding and removing item Return a 1-element array to keep the item, a multiple-element array to add items, or a 0-element array to remove the item.

    -
    // Let's say we want to remove all the negative numbers
    +
    // Let's say we want to remove all the negative numbers
     // and split the odd numbers into an even number and a 1
     let a = [5, 4, -3, 20, 17, -33, -4, 18]
     //       |\  \  x   |  | \   x   x   |
    diff --git a/files/en-us/web/javascript/reference/global_objects/array/foreach/index.html b/files/en-us/web/javascript/reference/global_objects/array/foreach/index.html
    index 0755aac513ac4c4..d2c10dc0c1031fa 100644
    --- a/files/en-us/web/javascript/reference/global_objects/array/foreach/index.html
    +++ b/files/en-us/web/javascript/reference/global_objects/array/foreach/index.html
    @@ -18,7 +18,7 @@
     
     

    Syntax

    -
    arr.forEach(callback(currentValue[, index[, array]]) {
    +
    arr.forEach(callback(currentValue[, index[, array]]) {
       // execute something
     }[, thisArg]);
    @@ -124,7 +124,7 @@

    forEach expects a synchronous fu

    Example Code
    -
    let ratings = [5, 4, 5];
    +  
    let ratings = [5, 4, 5];
     let sum = 0;
     
     let sumFunction = async function (a, b)
    @@ -154,7 +154,7 @@ 

    Polyfill

    that fun.call evaluates to the original value of {{jsxref("Function.prototype.call()")}}.

    -
    // Production steps of ECMA-262, Edition 5, 15.4.4.18
    +
    // Production steps of ECMA-262, Edition 5, 15.4.4.18
     // Reference: https://es5.github.io/#x15.4.4.18
     
     if (!Array.prototype['forEach']) {
    @@ -217,7 +217,7 @@ 

    Examples

    No operation for uninitialized values (sparse arrays)

    const arraySparse = [1,3,,7]
    +  class="brush: js">const arraySparse = [1,3,,7]
     let numCallbackRuns = 0
     
     arraySparse.forEach(function(element) {
    @@ -235,7 +235,7 @@ 

    No operation for uninitialized values (sparse arrays)

    Converting a for loop to forEach

    -
    const items = ['item1', 'item2', 'item3']
    +
    const items = ['item1', 'item2', 'item3']
     const copyItems = []
     
     // before
    @@ -262,7 +262,7 @@ 

    Printing the contents of an array

    The following code logs a line for each element in an array:

    -
    function logArrayElements(element, index, array) {
    +
    function logArrayElements(element, index, array) {
       console.log('a[' + index + '] = ' + element)
     }
     
    @@ -280,7 +280,7 @@ 

    Using thisArg

    The following (contrived) example updates an object's properties from each entry in the array:

    -
    function Counter() {
    +
    function Counter() {
       this.sum = 0
       this.count = 0
     }
    @@ -319,7 +319,7 @@ 

    An object copy function

    and is presented to explain how Array.prototype.forEach() works by using ECMAScript 5 Object.* meta property functions.

    -
    function copy(obj) {
    +
    function copy(obj) {
       const copy = Object.create(Object.getPrototypeOf(obj))
       const propNames = Object.getOwnPropertyNames(obj)
     
    @@ -346,7 +346,7 @@ 

    Modifying the array during iterati

    forEach() does not make a copy of the array before iterating.

    -
    let words = ['one', 'two', 'three', 'four']
    +
    let words = ['one', 'two', 'three', 'four']
     words.forEach(function(word) {
       console.log(word)
       if (word === 'two') {
    @@ -363,7 +363,7 @@ 

    Flatten an array

    The following example is only here for learning purpose. If you want to flatten an array using built-in methods you can use {{jsxref("Array.prototype.flat()")}}.

    -
    function flatten(arr) {
    +
    function flatten(arr) {
       const result = []
     
       arr.forEach(function(i) {
    diff --git a/files/en-us/web/javascript/reference/global_objects/array/from/index.html b/files/en-us/web/javascript/reference/global_objects/array/from/index.html
    index 03702d2c842017a..38ba8e31a8894c0 100644
    --- a/files/en-us/web/javascript/reference/global_objects/array/from/index.html
    +++ b/files/en-us/web/javascript/reference/global_objects/array/from/index.html
    @@ -19,7 +19,7 @@
     
     

    Syntax

    -
    Array.from(arrayLike [, mapFn [, thisArg]])
    +
    Array.from(arrayLike [, mapFn [, thisArg]])
     

    Parameters

    @@ -76,18 +76,18 @@

    Examples

    Array from a String

    -
    Array.from('foo');
    +
    Array.from('foo');
     // [ "f", "o", "o" ]

    Array from a Set

    -
    const set = new Set(['foo', 'bar', 'baz', 'foo']);
    +
    const set = new Set(['foo', 'bar', 'baz', 'foo']);
     Array.from(set);
     // [ "foo", "bar", "baz" ]

    Array from a Map

    -
    const map = new Map([[1, 2], [2, 4], [4, 8]]);
    +
    const map = new Map([[1, 2], [2, 4], [4, 8]]);
     Array.from(map);
     // [[1, 2], [2, 4], [4, 8]]
     
    @@ -101,7 +101,7 @@ 

    Array from a Map

    Array from a NodeList

    -
    // Create an array based on a property of DOM Elements
    +
    // Create an array based on a property of DOM Elements
     const images = document.getElementsByTagName('img');
     const sources = Array.from(images, image => image.src);
     const insecureSources = sources.filter(link => link.startsWith('http://'));
    @@ -109,7 +109,7 @@

    Array from a NodeList

    Array from an Array-like object (arguments)

    -
    function f() {
    +
    function f() {
       return Array.from(arguments);
     }
     
    @@ -120,7 +120,7 @@ 

    Array from an Array-like obje

    Using arrow functions and Array.from()

    -
    // Using an arrow function as the map function to
    +
    // Using an arrow function as the map function to
     // manipulate the elements
     Array.from([1, 2, 3], x => x + x);
     // [2, 4, 6]
    @@ -134,7 +134,7 @@ 

    Using arrow functions and

    Sequence generator (range)

    -
    // Sequence generator function (commonly referred to as "range", e.g. Clojure, PHP etc)
    +
    // Sequence generator function (commonly referred to as "range", e.g. Clojure, PHP etc)
     const range = (start, stop, step) => Array.from({ length: (stop - start) / step + 1}, (_, i) => start + (i * step));
     
     // Generate numbers range 0..4
    @@ -193,7 +193,7 @@ 

    Polyfill

    ECMA-262.

  • -
    // Production steps of ECMA-262, Edition 6, 22.1.2.1
    +
    // Production steps of ECMA-262, Edition 6, 22.1.2.1
     if (!Array.from) {
         Array.from = (function () {
             var symbolIterator;
    diff --git a/files/en-us/web/javascript/reference/global_objects/array/includes/index.html b/files/en-us/web/javascript/reference/global_objects/array/includes/index.html
    index 0acf967470c870d..a507adad1276032 100644
    --- a/files/en-us/web/javascript/reference/global_objects/array/includes/index.html
    +++ b/files/en-us/web/javascript/reference/global_objects/array/includes/index.html
    @@ -27,7 +27,7 @@
     
     

    Syntax

    -
    arr.includes(valueToFind[, fromIndex])
    +
    arr.includes(valueToFind[, fromIndex])
     

    Parameters

    @@ -72,7 +72,7 @@

    Return value

    Examples

    -
    [1, 2, 3].includes(2)      // true
    +
    [1, 2, 3].includes(2)      // true
     [1, 2, 3].includes(4)      // false
     [1, 2, 3].includes(3, 3)   // false
     [1, 2, 3].includes(3, -1)  // true
    @@ -85,7 +85,7 @@ 

    If fromIndex is greater than or equal to the length of the array, false is returned. The array will not be searched.

    -
    let arr = ['a', 'b', 'c']
    +
    let arr = ['a', 'b', 'c']
     
     arr.includes('c', 3)    // false
     arr.includes('c', 100)  // false
    @@ -98,7 +98,7 @@ 

    Computed index is less than 0

    valueToFind. If the computed index is less or equal than -1 * arr.length, the entire array will be searched.

    -
    // array length is 3
    +
    // array length is 3
     // fromIndex is -100
     // computed index is 3 + (-100) = -97
     
    @@ -120,7 +120,7 @@ 

    includes() used as a generic methodarguments object.

    -
    (function() {
    +
    (function() {
       console.log(Array.prototype.includes.call(arguments, 'a'))  // true
       console.log(Array.prototype.includes.call(arguments, 'd'))  // false
     })('a','b','c') 
    diff --git a/files/en-us/web/javascript/reference/global_objects/array/index.html b/files/en-us/web/javascript/reference/global_objects/array/index.html index c7d3f76cb96e96b..5e3c17238472f8a 100644 --- a/files/en-us/web/javascript/reference/global_objects/array/index.html +++ b/files/en-us/web/javascript/reference/global_objects/array/index.html @@ -23,7 +23,7 @@

    Common operations

    Create an Array

    -
    let fruits = ['Apple', 'Banana']
    +
    let fruits = ['Apple', 'Banana']
     
     console.log(fruits.length)
     // 2
    @@ -31,7 +31,7 @@ 

    Common operations

    Access an Array item using the index position

    -
    let first = fruits[0]
    +
    let first = fruits[0]
     // Apple
     
     let last = fruits[fruits.length - 1]
    @@ -40,7 +40,7 @@ 

    Common operations

    Loop over an Array

    -
    fruits.forEach(function(item, index, array) {
    +
    fruits.forEach(function(item, index, array) {
       console.log(item, index)
     })
     // Apple 0
    @@ -49,31 +49,31 @@ 

    Common operations

    Add an item to the end of an Array

    -
    let newLength = fruits.push('Orange')
    +
    let newLength = fruits.push('Orange')
     // ["Apple", "Banana", "Orange"]
     

    Remove an item from the end of an Array

    -
    let last = fruits.pop() // remove Orange (from the end)
    +
    let last = fruits.pop() // remove Orange (from the end)
     // ["Apple", "Banana"]
     

    Remove an item from the beginning of an Array

    -
    let first = fruits.shift() // remove Apple from the front
    +
    let first = fruits.shift() // remove Apple from the front
     // ["Banana"]
     

    Add an item to the beginning of an Array

    -
    let newLength = fruits.unshift('Strawberry') // add to the front
    +
    let newLength = fruits.unshift('Strawberry') // add to the front
     // ["Strawberry", "Banana"]
     

    Find the index of an item in the Array

    -
    fruits.push('Mango')
    +
    fruits.push('Mango')
     // ["Strawberry", "Banana", "Mango"]
     
     let pos = fruits.indexOf('Banana')
    @@ -82,13 +82,13 @@ 

    Common operations

    Remove an item by index position

    -
    let removedItem = fruits.splice(pos, 1) // this is how to remove an item
    +
    let removedItem = fruits.splice(pos, 1) // this is how to remove an item
     
     // ["Strawberry", "Mango"]

    Remove items from an index position

    -
    let vegetables = ['Cabbage', 'Turnip', 'Radish', 'Carrot']
    +
    let vegetables = ['Cabbage', 'Turnip', 'Radish', 'Carrot']
     console.log(vegetables)
     // ["Cabbage", "Turnip", "Radish", "Carrot"]
     
    @@ -108,7 +108,7 @@ 

    Common operations

    Copy an Array

    -
    let shallowCopy = fruits.slice() // this is how to make a copy
    +
    let shallowCopy = fruits.slice() // this is how to make a copy
     // ["Strawberry", "Mango"]
     
    @@ -118,7 +118,7 @@

    Accessing array elements

    Using an invalid index number returns undefined.

    -
    let arr = ['this is the first element', 'this is the second element', 'this is the last element']
    +
    let arr = ['this is the first element', 'this is the second element', 'this is the last element']
     console.log(arr[0])              // logs 'this is the first element'
     console.log(arr[1])              // logs 'this is the second element'
     console.log(arr[arr.length - 1]) // logs 'this is the last element'
    @@ -126,19 +126,19 @@ 

    Accessing array elements

    Array elements are object properties in the same way that toString is a property (to be specific, however, toString() is a method). Nevertheless, trying to access an element of an array as follows throws a syntax error because the property name is not valid:

    -
    console.log(arr.0) // a syntax error
    +
    console.log(arr.0) // a syntax error
     

    There is nothing special about JavaScript arrays and the properties that cause this. JavaScript properties that begin with a digit cannot be referenced with dot notation and must be accessed using bracket notation.

    For example, if you had an object with a property named 3d, it can only be referenced using bracket notation.

    -
    let years = [1950, 1960, 1970, 1980, 1990, 2000, 2010]
    +
    let years = [1950, 1960, 1970, 1980, 1990, 2000, 2010]
     console.log(years.0)   // a syntax error
     console.log(years[0])  // works properly
     
    -
    renderer.3d.setTexture(model, 'character.png')     // a syntax error
    +
    renderer.3d.setTexture(model, 'character.png')     // a syntax error
     renderer['3d'].setTexture(model, 'character.png')  // works properly
     
    @@ -146,7 +146,7 @@

    Accessing array elements

    The 2 in years[2] is coerced into a string by the JavaScript engine through an implicit toString conversion. As a result, '2' and '02' would refer to two different slots on the years object, and the following example could be true:

    -
    console.log(years['2'] != years['02'])
    +
    console.log(years['2'] != years['02'])
     

    Relationship between length and numerical properties

    @@ -157,7 +157,7 @@

    Relationship betwe

    Other methods (e.g., {{jsxref("Array.push", "push()")}}, {{jsxref("Array.splice", "splice()")}}, etc.) also result in updates to an array's {{jsxref("Array.length", "length")}} property.

    -
    const fruits = []
    +
    const fruits = []
     fruits.push('banana', 'apple', 'peach')
     
     console.log(fruits.length) // 3
    @@ -165,7 +165,7 @@ 

    Relationship betwe

    When setting a property on a JavaScript array when the property is a valid array index and that index is outside the current bounds of the array, the engine will update the array's {{jsxref("Array.length", "length")}} property accordingly:

    -
    fruits[5] = 'mango'
    +
    fruits[5] = 'mango'
     console.log(fruits[5])            // 'mango'
     console.log(Object.keys(fruits))  // ['0', '1', '2', '5']
     console.log(fruits.length)        // 6
    @@ -173,7 +173,7 @@ 

    Relationship betwe

    Increasing the {{jsxref("Array.length", "length")}}.

    -
    fruits.length = 10
    +
    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
    @@ -182,7 +182,7 @@ 

    Relationship betwe

    Decreasing the {{jsxref("Array.length", "length")}} property does, however, delete elements.

    -
    fruits.length = 2
    +
    fruits.length = 2
     console.log(Object.keys(fruits)) // ['0', '1']
     console.log(fruits.length)       // 2
     
    @@ -195,7 +195,7 @@

    Creating an array using t

    To help explain these properties and elements, see this example and then refer to the table below:

    -
    // Match one d followed by one or more b's followed by one d
    +
    // Match one d followed by one or more b's followed by one d
     // Remember matched b's and the following d
     // Ignore case
     
    @@ -349,7 +349,7 @@ 

    Creating an array

    The following example creates an array, msgArray, with a length of 0, then assigns values to msgArray[0] and msgArray[99], changing the length of the array to 100.

    -
    let msgArray = []
    +
    let msgArray = []
     msgArray[0] = 'Hello'
     msgArray[99] = 'world'
     
    @@ -362,7 +362,7 @@ 

    Creating a two-dimensional array

    The following creates a chessboard as a two-dimensional array of strings. The first move is made by copying the 'p' in board[6][4] to board[4][4]. The old position at [6][4] is made blank.

    -
    let board = [
    +
    let board = [
       ['R','N','B','Q','K','B','N','R'],
       ['P','P','P','P','P','P','P','P'],
       [' ',' ',' ',' ',' ',' ',' ',' '],
    @@ -382,7 +382,7 @@ 

    Creating a two-dimensional array

    Here is the output:

    -
    R,N,B,Q,K,B,N,R
    +
    R,N,B,Q,K,B,N,R
     P,P,P,P,P,P,P,P
      , , , , , , ,
      , , , , , , ,
    @@ -403,7 +403,7 @@ 

    Creating a two-dimensional array

    Using an array to tabulate a set of values

    -
    values = []
    +
    values = []
     for (let x = 0; x < 10; x++){
      values.push([
       2 ** x,
    @@ -414,7 +414,7 @@ 

    Using an array to tabulate a

    Results in

    -
    // The first column is the index
    +
    // The first column is the index
     0	1	0
     1	2	2
     2	4	8
    diff --git a/files/en-us/web/javascript/reference/global_objects/array/indexof/index.html b/files/en-us/web/javascript/reference/global_objects/array/indexof/index.html
    index 50fcf39b1d00635..c7eedc20a018c7d 100644
    --- a/files/en-us/web/javascript/reference/global_objects/array/indexof/index.html
    +++ b/files/en-us/web/javascript/reference/global_objects/array/indexof/index.html
    @@ -26,7 +26,7 @@
     

    Syntax

    arr.indexOf(searchElement[, fromIndex])
    + class="brush: js">arr.indexOf(searchElement[, fromIndex])

    Parameters

    @@ -65,7 +65,7 @@

    Using indexOf()

    The following example uses indexOf() to locate values in an array.

    -
    var array = [2, 9, 9];
    +
    var array = [2, 9, 9];
     array.indexOf(2);     // 0
     array.indexOf(7);     // -1
     array.indexOf(9, 2);  // 2
    @@ -76,7 +76,7 @@ 

    Using indexOf()

    Finding all the occurrences of an element

    -
    var indices = [];
    +
    var indices = [];
     var array = ['a', 'b', 'a', 'c', 'a', 'd'];
     var element = 'a';
     var idx = array.indexOf(element);
    @@ -91,7 +91,7 @@ 

    Finding all the occurrences o

    Finding if an element exists in the array or not and updating the array

    -
    function updateVegetablesCollection (veggies, veggie) {
    +
    function updateVegetablesCollection (veggies, veggie) {
         if (veggies.indexOf(veggie) === -1) {
             veggies.push(veggie);
             console.log('New veggies collection is : ' + veggies);
    @@ -117,7 +117,7 @@ 

    Polyfill

    one specified in ECMA-262, 5th edition, assuming {{jsxref("Global_Objects/TypeError", "TypeError")}} and {{jsxref("Math.abs()")}} have their original values.

    -
    // This version tries to optimize by only checking for "in" when looking for undefined and
    +
    // This version tries to optimize by only checking for "in" when looking for undefined and
     // skipping the definitely fruitless NaN search. Other parts are merely cosmetic conciseness.
     // Whether it is actually faster remains to be seen.
     if (!Array.prototype.indexOf)
    @@ -147,7 +147,7 @@ 

    Polyfill

    ECMA standard, and are less concerned about performance or conciseness, then you may find this more descriptive polyfill to be more useful.

    -
    // Production steps of ECMA-262, Edition 5, 15.4.4.14
    +
    // Production steps of ECMA-262, Edition 5, 15.4.4.14
     // Reference: https://es5.github.io/#x15.4.4.14
     if (!Array.prototype.indexOf) {
       Array.prototype.indexOf = function(searchElement, fromIndex) {
    diff --git a/files/en-us/web/javascript/reference/global_objects/array/isarray/index.html b/files/en-us/web/javascript/reference/global_objects/array/isarray/index.html
    index c95a37d100cb27d..ab2e106d0d93ed1 100644
    --- a/files/en-us/web/javascript/reference/global_objects/array/isarray/index.html
    +++ b/files/en-us/web/javascript/reference/global_objects/array/isarray/index.html
    @@ -22,7 +22,7 @@
     
     

    Syntax

    -
    Array.isArray(value)
    +
    Array.isArray(value)

    Parameters

    diff --git a/files/en-us/web/javascript/reference/global_objects/array/join/index.html b/files/en-us/web/javascript/reference/global_objects/array/join/index.html index 058f97d3352b974..d73a3c814e61a7c 100644 --- a/files/en-us/web/javascript/reference/global_objects/array/join/index.html +++ b/files/en-us/web/javascript/reference/global_objects/array/join/index.html @@ -21,7 +21,7 @@

    Syntax

    arr.join([separator])
    + class="brush: js">arr.join([separator])

    Parameters

    diff --git a/files/en-us/web/javascript/reference/global_objects/array/keys/index.html b/files/en-us/web/javascript/reference/global_objects/array/keys/index.html index 14b841ce86027d3..5c3924c728310be 100644 --- a/files/en-us/web/javascript/reference/global_objects/array/keys/index.html +++ b/files/en-us/web/javascript/reference/global_objects/array/keys/index.html @@ -25,7 +25,7 @@

    Syntax

    -
    arr.keys()
    +
    arr.keys()

    Return value

    @@ -35,7 +35,7 @@

    Examples

    Key iterator doesn't ignore holes

    -
    var arr = ['a', , 'c'];
    +
    var arr = ['a', , 'c'];
     var sparseKeys = Object.keys(arr);
     var denseKeys = [...arr.keys()];
     console.log(sparseKeys); // ['0', '2']
    diff --git a/files/en-us/web/javascript/reference/global_objects/array/lastindexof/index.html b/files/en-us/web/javascript/reference/global_objects/array/lastindexof/index.html
    index 02649787677acb5..33475abefc8de22 100644
    --- a/files/en-us/web/javascript/reference/global_objects/array/lastindexof/index.html
    +++ b/files/en-us/web/javascript/reference/global_objects/array/lastindexof/index.html
    @@ -19,7 +19,7 @@
     
     

    Syntax

    -
    arr.lastIndexOf(searchElement[, fromIndex])
    +
    arr.lastIndexOf(searchElement[, fromIndex])
     

    Parameters

    @@ -54,7 +54,7 @@

    Using lastIndexOf

    The following example uses lastIndexOf to locate values in an array.

    -
    var numbers = [2, 5, 9, 2];
    +
    var numbers = [2, 5, 9, 2];
     numbers.lastIndexOf(2);     // 3
     numbers.lastIndexOf(7);     // -1
     numbers.lastIndexOf(2, 3);  // 3
    @@ -70,7 +70,7 @@ 

    Finding all the occurrences o element in a given array, using {{jsxref("Array.prototype.push", "push")}} to add them to another array as they are found.

    -
    var indices = [];
    +
    var indices = [];
     var array = ['a', 'b', 'a', 'c', 'a', 'd'];
     var element = 'a';
     var idx = array.lastIndexOf(element);
    @@ -99,7 +99,7 @@ 

    Polyfill

    {{jsxref("Math.floor")}}, {{jsxref("Math.abs")}}, and {{jsxref("Math.min")}} have their original values.

    -
    // Production steps of ECMA-262, Edition 5, 15.4.4.15
    +
    // Production steps of ECMA-262, Edition 5, 15.4.4.15
     // Reference: https://es5.github.io/#x15.4.4.15
     if (!Array.prototype.lastIndexOf) {
       Array.prototype.lastIndexOf = function(searchElement /*, fromIndex*/) {
    diff --git a/files/en-us/web/javascript/reference/global_objects/array/length/index.html b/files/en-us/web/javascript/reference/global_objects/array/length/index.html
    index 1386e77e4265d80..d43391526acc322 100644
    --- a/files/en-us/web/javascript/reference/global_objects/array/length/index.html
    +++ b/files/en-us/web/javascript/reference/global_objects/array/length/index.html
    @@ -19,7 +19,7 @@ 

    Description

    The value of the length property is an integer with a positive sign and a value less than 2 to the 32nd power (232).

    -
    var namelistA = new Array(4294967296); //2 to the 32nd power = 4294967296
    +
    var namelistA = new Array(4294967296); //2 to the 32nd power = 4294967296
     var namelistC = new Array(-100) //negative sign
     
     console.log(namelistA.length); //RangeError: Invalid array length
    @@ -34,7 +34,7 @@ 

    Description

    You can set the length property to truncate an array at any time. When you extend an array by changing its length property, the number of actual elements increases; for example, if you set length to 3 when it is currently 2, the array now contains 3 elements, which causes the third element to be a non-iterable empty slot.

    -
    const arr = [1, 2];
    +
    const arr = [1, 2];
     console.log(arr);
     // [ 1, 2 ]
     
    @@ -63,7 +63,7 @@ 

    Iterating over an array

    In the following example, the array numbers is iterated through by looking at the length property. The value in each element is then doubled.

    -
    var numbers = [1, 2, 3, 4, 5];
    +
    var numbers = [1, 2, 3, 4, 5];
     var length = numbers.length;
     for (var i = 0; i < length; i++) {
       numbers[i] *= 2;
    @@ -75,7 +75,7 @@ 

    Shortening an array

    The following example shortens the array numbers to a length of 3 if the current length is greater than 3.

    -
    var numbers = [1, 2, 3, 4, 5];
    +
    var numbers = [1, 2, 3, 4, 5];
     
     if (numbers.length > 3) {
       numbers.length = 3;
    @@ -87,7 +87,7 @@ 

    Shortening an array

    Create empty array of fixed length

    -
    var numbers = [];
    +
    var numbers = [];
     numbers.length = 3;
     console.log(numbers); // [undefined, undefined, undefined]
     
    diff --git a/files/en-us/web/javascript/reference/global_objects/array/map/index.html b/files/en-us/web/javascript/reference/global_objects/array/map/index.html index 0778be2c8c8c0b2..6ce156b22c53de8 100644 --- a/files/en-us/web/javascript/reference/global_objects/array/map/index.html +++ b/files/en-us/web/javascript/reference/global_objects/array/map/index.html @@ -26,7 +26,7 @@

    Syntax

    -
    let newArray = arr.map(callback(currentValue[, index[, array]]) {
    +
    let newArray = arr.map(callback(currentValue[, index[, array]]) {
       // return element for newArray, after executing something
     }[, thisArg]);
     
    @@ -126,7 +126,7 @@

    Polyfill

    their original values and that callback.call evaluates to the original value of {{jsxref("Function.prototype.call")}}.

    -
    // Production steps of ECMA-262, Edition 5, 15.4.4.19
    +
    // Production steps of ECMA-262, Edition 5, 15.4.4.19
     // Reference: https://es5.github.io/#x15.4.4.19
     if (!Array.prototype.map) {
     
    @@ -225,7 +225,7 @@ 

    Mapping an arra

    The following code takes an array of numbers and creates a new array containing the square roots of the numbers in the first array.

    -
    let numbers = [1, 4, 9]
    +
    let numbers = [1, 4, 9]
     let roots = numbers.map(function(num) {
         return Math.sqrt(num)
     })
    @@ -239,7 +239,7 @@ 

    Using map to reformat objects

    The following code takes an array of objects and creates a new array containing the newly reformatted objects.

    -
    let kvArray = [{key: 1, value: 10},
    +
    let kvArray = [{key: 1, value: 10},
                    {key: 2, value: 20},
                    {key: 3, value: 30}]
     
    @@ -263,7 +263,7 @@ 

    Map argument is used with it. The argument will automatically be assigned from each element of the array as map loops through the original array.

    -
    let numbers = [1, 4, 9]
    +
    let numbers = [1, 4, 9]
     let doubles = numbers.map(function(num) {
       return num * 2
     })
    @@ -277,7 +277,7 @@ 

    Using map generically

    This example shows how to use map on a {{jsxref("String")}} to get an array of bytes in the ASCII encoding representing the character values:

    -
    let map = Array.prototype.map
    +
    let map = Array.prototype.map
     let a = map.call('Hello World', function(x) {
       return x.charCodeAt(0)
     })
    @@ -294,7 +294,7 @@ 

    Using map generically querySelec

    In this case, we return all the selected options' values on the screen:

    -
    let elems = document.querySelectorAll('select option:checked')
    +
    let elems = document.querySelectorAll('select option:checked')
     let values = Array.prototype.map.call(elems, function(obj) {
       return obj.value
     })
    @@ -313,7 +313,7 @@ 

    Tricky use case

    Consider:

    -
    ["1", "2", "3"].map(parseInt)
    +
    ["1", "2", "3"].map(parseInt)

    While one might expect [1, 2, 3], the actual result is [1, NaN, NaN].

    @@ -333,7 +333,7 @@

    Tricky use case

    Here is a concise example of the iteration steps:

    -
    // parseInt(string, radix) -> map(parseInt(value, index))
    +
    // parseInt(string, radix) -> map(parseInt(value, index))
     /*  first iteration  (index is 0): */ parseInt("1", 0)  // 1
     /*  second iteration (index is 1): */ parseInt("2", 1)  // NaN
     /*  third iteration  (index is 2): */ parseInt("3", 2)  // NaN
    @@ -341,7 +341,7 @@ 

    Tricky use case

    Then let's talk about solutions.

    -
    function returnInt(element) {
    +
    function returnInt(element) {
       return parseInt(element, 10)
     }
     
    @@ -364,7 +364,7 @@ 

    Tricky use case

    One alternative output of the map method being called with {{jsxref("parseInt")}} as a parameter runs as follows:

    -
    let xs = ['10', '10', '10']
    +
    let xs = ['10', '10', '10']
     
     xs = xs.map(parseInt)
     
    @@ -375,7 +375,7 @@ 

    Mapped array contains undefined

    When {{jsxref("undefined")}} or nothing is returned:

    -
    let numbers = [1, 2, 3, 4]
    +
    let numbers = [1, 2, 3, 4]
     let filteredNumbers = numbers.map(function(num, index) {
       if (index < 3) {
          return num
    diff --git a/files/en-us/web/javascript/reference/global_objects/array/of/index.html b/files/en-us/web/javascript/reference/global_objects/array/of/index.html
    index 7507189960f50c8..a08792d64c94dc7 100644
    --- a/files/en-us/web/javascript/reference/global_objects/array/of/index.html
    +++ b/files/en-us/web/javascript/reference/global_objects/array/of/index.html
    @@ -22,7 +22,7 @@
       implies an array of 7 empty slots, not slots with actual
       {{jsxref("undefined")}} values).

    -
    Array.of(7); // [7]
    +
    Array.of(7); // [7]
     Array(7); // array of 7 empty slots
     
     Array.of(1, 2, 3); // [1, 2, 3]
    @@ -32,7 +32,7 @@
     

    Syntax

    Array.of(element0[, element1[, ...[, elementN]]])
    + class="brush: js">Array.of(element0[, element1[, ...[, elementN]]])

    Parameters

    @@ -64,7 +64,7 @@

    Polyfill

    Running the following code before any other code will create Array.of() if it's not natively available.

    -
    if (!Array.of) {
    +
    if (!Array.of) {
       Array.of = function() {
         return Array.prototype.slice.call(arguments);
         // Or
    @@ -81,7 +81,7 @@ 

    Examples

    Using Array.of

    -
    Array.of(1);         // [1]
    +
    Array.of(1);         // [1]
     Array.of(1, 2, 3);   // [1, 2, 3]
     Array.of(undefined); // [undefined]
     
    diff --git a/files/en-us/web/javascript/reference/global_objects/array/pop/index.html b/files/en-us/web/javascript/reference/global_objects/array/pop/index.html index d9b23ce87e690bc..9f9dee45a98a82c 100644 --- a/files/en-us/web/javascript/reference/global_objects/array/pop/index.html +++ b/files/en-us/web/javascript/reference/global_objects/array/pop/index.html @@ -24,7 +24,7 @@

    Syntax

    -
    arr.pop()
    +
    arr.pop()

    Return value

    @@ -54,7 +54,7 @@

    Removing the last element of an a

    The following code creates the myFish array containing four elements, then removes its last element.

    -
    var myFish = ['angel', 'clown', 'mandarin', 'sturgeon'];
    +
    var myFish = ['angel', 'clown', 'mandarin', 'sturgeon'];
     
     var popped = myFish.pop();
     
    @@ -69,7 +69,7 @@ 

    Using apply( ) or call ( ) on elements and a length parameter, then removes its last element and decrements the length parameter.

    -
    var myFish = {0:'angel', 1:'clown', 2:'mandarin', 3:'sturgeon', length: 4};
    +
    var myFish = {0:'angel', 1:'clown', 2:'mandarin', 3:'sturgeon', length: 4};
     
     var popped = Array.prototype.pop.call(myFish); //same syntax for using apply( )
     
    diff --git a/files/en-us/web/javascript/reference/global_objects/array/push/index.html b/files/en-us/web/javascript/reference/global_objects/array/push/index.html
    index 4dc9c1fdc5813ea..695f66f53d7ad00 100644
    --- a/files/en-us/web/javascript/reference/global_objects/array/push/index.html
    +++ b/files/en-us/web/javascript/reference/global_objects/array/push/index.html
    @@ -24,7 +24,7 @@
     

    Syntax

    arr.push([element1[, ...[, elementN]]])
    + class="brush: js">arr.push([element1[, ...[, elementN]]])

    Parameters

    @@ -63,7 +63,7 @@

    Adding elements to an array

    appends two elements to it. The total variable contains the new length of the array.

    -
    let sports = ['soccer', 'baseball']
    +
    let sports = ['soccer', 'baseball']
     let total = sports.push('football', 'swimming')
     
     console.log(sports)  // ['soccer', 'baseball', 'football', 'swimming']
    @@ -80,7 +80,7 @@ 

    Merging two arrays

    take is limited in practice. See {{jsxref("Function.apply", "apply()")}} for more details.

    -
    let vegetables = ['parsnip', 'potato']
    +
    let vegetables = ['parsnip', 'potato']
     let moreVegs = ['celery', 'beetroot']
     
     // Merge the second array into the first one
    @@ -103,7 +103,7 @@ 

    Using an object in an array-li an array—and it just works, thanks to the way JavaScript allows us to establish the execution context in any way we want.

    -
    let obj = {
    +
    let obj = {
         length: 0,
     
         addElem: function addElem(elem) {
    diff --git a/files/en-us/web/javascript/reference/global_objects/array/reduce/index.html b/files/en-us/web/javascript/reference/global_objects/array/reduce/index.html
    index 4cf476b14762ea5..0acb3565ab7970e 100644
    --- a/files/en-us/web/javascript/reference/global_objects/array/reduce/index.html
    +++ b/files/en-us/web/javascript/reference/global_objects/array/reduce/index.html
    @@ -41,7 +41,7 @@
     

    Syntax

    arr.reduce(callback( accumulator, currentValue, [, index[, array]] )[, initialValue])
    + class="brush: js">arr.reduce(callback( accumulator, currentValue, [, index[, array]] )[, initialValue])

    Parameters

    @@ -122,7 +122,7 @@

    Description

    there can be up to four possible output types without initialValue, as shown in the following example:

    -
    let maxCallback = ( acc, cur ) => Math.max( acc.x, cur.x );
    +
    let maxCallback = ( acc, cur ) => Math.max( acc.x, cur.x );
     let maxCallback2 = ( max, cur ) => Math.max( max, cur );
     
     // reduce without initialValue
    @@ -140,7 +140,7 @@ 

    How reduce() works

    Suppose the following use of reduce() occurred:

    -
    [0, 1, 2, 3, 4].reduce(function(accumulator, currentValue, currentIndex, array) {
    +
    [0, 1, 2, 3, 4].reduce(function(accumulator, currentValue, currentIndex, array) {
       return accumulator + currentValue
     })
     
    @@ -202,13 +202,13 @@

    How reduce() works

    instead of a full function. The code below will produce the same output as the code in the block above:

    -
    [0, 1, 2, 3, 4].reduce( (accumulator, currentValue, currentIndex, array) => accumulator + currentValue )
    +
    [0, 1, 2, 3, 4].reduce( (accumulator, currentValue, currentIndex, array) => accumulator + currentValue )
     

    If you were to provide an initialValue as the second argument to reduce(), the result would look like this:

    -
    [0, 1, 2, 3, 4].reduce((accumulator, currentValue, currentIndex, array) => {
    +
    [0, 1, 2, 3, 4].reduce((accumulator, currentValue, currentIndex, array) => {
         return accumulator + currentValue
     }, 10)
     
    @@ -272,7 +272,7 @@

    How reduce() works

    Polyfill

    -
    // Production steps of ECMA-262, Edition 5, 15.4.4.21
    +
    // Production steps of ECMA-262, Edition 5, 15.4.4.21
     // Reference: https://es5.github.io/#x15.4.4.21
     // https://tc39.github.io/ecma262/#sec-array.prototype.reduce
     if (!Array.prototype.reduce) {
    @@ -348,7 +348,7 @@ 

    Examples

    Sum all the values of an array

    -
    let sum = [0, 1, 2, 3].reduce(function (accumulator, currentValue) {
    +
    let sum = [0, 1, 2, 3].reduce(function (accumulator, currentValue) {
       return accumulator + currentValue
     }, 0)
     // sum is 6
    @@ -357,7 +357,7 @@ 

    Sum all the values of an array

    Alternatively written with an arrow function:

    -
    let total = [ 0, 1, 2, 3 ].reduce(
    +
    let total = [ 0, 1, 2, 3 ].reduce(
       ( accumulator, currentValue ) => accumulator + currentValue,
       0
     )
    @@ -368,7 +368,7 @@

    Sum of values in an object array

    an initialValue, so that each item passes through your function.

    -
    let initialValue = 0
    +
    let initialValue = 0
     let sum = [{x: 1}, {x: 2}, {x: 3}].reduce(function (accumulator, currentValue) {
         return accumulator + currentValue.x
     }, initialValue)
    @@ -378,7 +378,7 @@ 

    Sum of values in an object array

    Alternatively written with an arrow function:

    -
    let initialValue = 0
    +
    let initialValue = 0
     let sum = [{x: 1}, {x: 2}, {x: 3}].reduce(
         (accumulator, currentValue) => accumulator + currentValue.x
         , initialValue
    @@ -388,7 +388,7 @@ 

    Sum of values in an object array

    Flatten an array of arrays

    -
    let flattened = [[0, 1], [2, 3], [4, 5]].reduce(
    +
    let flattened = [[0, 1], [2, 3], [4, 5]].reduce(
       function(accumulator, currentValue) {
         return accumulator.concat(currentValue)
       },
    @@ -399,7 +399,7 @@ 

    Flatten an array of arrays

    Alternatively written with an arrow function:

    -
    let flattened = [[0, 1], [2, 3], [4, 5]].reduce(
    +
    let flattened = [[0, 1], [2, 3], [4, 5]].reduce(
       ( accumulator, currentValue ) => accumulator.concat(currentValue),
       []
     )
    @@ -408,7 +408,7 @@ 

    Flatten an array of arrays

    Counting instances of values in an object

    -
    let names = ['Alice', 'Bob', 'Tiff', 'Bruce', 'Alice']
    +
    let names = ['Alice', 'Bob', 'Tiff', 'Bruce', 'Alice']
     
     let countedNames = names.reduce(function (allNames, name) {
       if (name in allNames) {
    @@ -425,7 +425,7 @@ 

    Counting instances of values

    Grouping objects by a property

    -
    let people = [
    +
    let people = [
       { name: 'Alice', age: 21 },
       { name: 'Max', age: 20 },
       { name: 'Jane', age: 20 }
    @@ -458,7 +458,7 @@ 

    Grouping objects by a property

    Bonding arrays contained in an array of objects using the spread operator and initialValue

    -
    // friends - an array of objects
    +
    // friends - an array of objects
     // where object field "books" is a list of favorite books
     let friends = [{
       name: 'Anna',
    @@ -495,7 +495,7 @@ 

    Remove duplicate items in an array

    -
    let myArray = ['a', 'b', 'a', 'b', 'c', 'e', 'e', 'c', 'd', 'd', 'd', 'd']
    +
    let myArray = ['a', 'b', 'a', 'b', 'c', 'e', 'e', 'c', 'd', 'd', 'd', 'd']
     let myOrderedArray = myArray.reduce(function (accumulator, currentValue) {
       if (accumulator.indexOf(currentValue) === -1) {
         accumulator.push(currentValue)
    @@ -512,7 +512,7 @@ 

    Replace .filter().map() with .reduce() {{jsxref("Array.reduce()")}}, thereby being more efficient. (If you like for loops, you can filter and map while traversing once with {{jsxref("Array.forEach()")}}).

    -
    const numbers = [-5, 6, 2, 0,];
    +
    const numbers = [-5, 6, 2, 0,];
     
     const doubledPositiveNumbers = numbers.reduce((accumulator, currentValue) => {
       if (currentValue > 0) {
    @@ -526,7 +526,7 @@ 

    Replace .filter().map() with .reduce()

    Running Promises in Sequence

    -
    /**
    +
    /**
      * Runs promises from array of functions that can return promises
      * in chained manner
      *
    @@ -573,7 +573,7 @@ 

    Running Promises in Sequence

    Function composition enabling piping

    -
    // Building-blocks to use for composition
    +
    // Building-blocks to use for composition
     const double = x => x + x
     const triple = x => 3 * x
     const quadruple = x => 4 * x
    @@ -600,7 +600,7 @@ 

    Function composition enabling pipi

    Write map using reduce

    -
    if (!Array.prototype.mapUsingReduce) {
    +
    if (!Array.prototype.mapUsingReduce) {
       Array.prototype.mapUsingReduce = function(callback, thisArg) {
         return this.reduce(function(mappedArray, currentValue, index, array) {
           mappedArray[index] = callback.call(thisArg, currentValue, index, array)
    diff --git a/files/en-us/web/javascript/reference/global_objects/array/reduceright/index.html b/files/en-us/web/javascript/reference/global_objects/array/reduceright/index.html
    index 864fc26f1c8d5b3..c19ac54e1fba685 100644
    --- a/files/en-us/web/javascript/reference/global_objects/array/reduceright/index.html
    +++ b/files/en-us/web/javascript/reference/global_objects/array/reduceright/index.html
    @@ -22,7 +22,7 @@
     

    Syntax

    arr.reduceRight(callback(accumulator, currentValue[, index[, array]])[, initialValue])
    + class="brush: js">arr.reduceRight(callback(accumulator, currentValue[, index[, array]])[, initialValue])

    Parameters

    @@ -62,7 +62,7 @@

    Description

    The call to the reduceRight callback would look something like this:

    -
    arr.reduceRight(function(accumulator, currentValue, index, array) {
    +
    arr.reduceRight(function(accumulator, currentValue, index, array) {
       // ...
     });
     
    @@ -85,7 +85,7 @@

    Description

    Some example run-throughs of the function would look like this:

    -
    [0, 1, 2, 3, 4].reduceRight(function(accumulator, currentValue, index, array) {
    +
    [0, 1, 2, 3, 4].reduceRight(function(accumulator, currentValue, index, array) {
       return accumulator + currentValue;
     });
     
    @@ -146,7 +146,7 @@

    Description

    And if you were to provide an initialValue, the result would look like this:

    -
    [0, 1, 2, 3, 4].reduceRight(function(accumulator, currentValue, index, array) {
    +
    [0, 1, 2, 3, 4].reduceRight(function(accumulator, currentValue, index, array) {
       return accumulator + currentValue;
     }, 10);
     
    @@ -216,7 +216,7 @@

    Polyfill

    by inserting the following code at the beginning of your scripts, allowing use of reduceRight in implementations which do not natively support it.

    -
    // Production steps of ECMA-262, Edition 5, 15.4.4.22
    +
    // Production steps of ECMA-262, Edition 5, 15.4.4.22
     // Reference: https://es5.github.io/#x15.4.4.22
     if ('function' !== typeof Array.prototype.reduceRight) {
       Array.prototype.reduceRight = function(callback /*, initialValue*/) {
    @@ -253,7 +253,7 @@ 

    Examples

    Sum up all values within an array

    -
    var sum = [0, 1, 2, 3].reduceRight(function(a, b) {
    +
    var sum = [0, 1, 2, 3].reduceRight(function(a, b) {
       return a + b;
     });
     // sum is 6
    @@ -261,7 +261,7 @@ 

    Sum up all values within an array

    Flatten an array of arrays

    -
    var flattened = [[0, 1], [2, 3], [4, 5]].reduceRight(function(a, b) {
    +
    var flattened = [[0, 1], [2, 3], [4, 5]].reduceRight(function(a, b) {
         return a.concat(b);
     }, []);
     // flattened is [4, 5, 2, 3, 0, 1]
    @@ -273,7 +273,7 @@ 

    Flatten an array of arrays

    Run a list of asynchronous functions with callbacks in series each passing their results to the next

    -
    const waterfall = (...functions) => (callback, ...args) =>
    +
    const waterfall = (...functions) => (callback, ...args) =>
       functions.reduceRight(
         (composition, fn) => (...results) => fn(composition, ...results),
         callback
    @@ -317,7 +317,7 @@ 

    Flatten an array of arrays

    Difference between reduce and reduceRight

    -
    var a = ['1', '2', '3', '4', '5'];
    +
    var a = ['1', '2', '3', '4', '5'];
     var left  = a.reduce(function(prev, cur)      { return prev + cur; });
     var right = a.reduceRight(function(prev, cur) { return prev + cur; });
     
    @@ -329,7 +329,7 @@ 

    Defining Composible Function

    The concept of compose function is simple it combines n functions. It’s a flowing right-to-left, calling each function with the output of the last one.

    -
    /**
    +
    /**
      * Function Composition is way in which result of one function can
      * be passed to another and so on.
      *
    diff --git a/files/en-us/web/javascript/reference/global_objects/array/reverse/index.html b/files/en-us/web/javascript/reference/global_objects/array/reverse/index.html
    index 23198f4f6b4c282..10a122d3ecb158e 100644
    --- a/files/en-us/web/javascript/reference/global_objects/array/reverse/index.html
    +++ b/files/en-us/web/javascript/reference/global_objects/array/reverse/index.html
    @@ -23,7 +23,7 @@
     
     

    Syntax

    -
    arr.reverse()
    +
    arr.reverse()

    Return value

    @@ -48,7 +48,7 @@

    Reversing the elements in an arrayreverse() returns a reference to the reversed array a.

    -
    const a = [1, 2, 3];
    +
    const a = [1, 2, 3];
     
     console.log(a); // [1, 2, 3]
     
    @@ -66,7 +66,7 @@ 

    Reversing the elements i reverse() returns a reference to the reversed array-like object a.

    -
    const a = {0: 1, 1: 2, 2: 3, length: 3};
    +
    const a = {0: 1, 1: 2, 2: 3, length: 3};
     
     console.log(a); // {0: 1, 1: 2, 2: 3, length: 3}
     
    diff --git a/files/en-us/web/javascript/reference/global_objects/array/shift/index.html b/files/en-us/web/javascript/reference/global_objects/array/shift/index.html
    index 2ab84bd0e97c39a..11b07c2ab219cba 100644
    --- a/files/en-us/web/javascript/reference/global_objects/array/shift/index.html
    +++ b/files/en-us/web/javascript/reference/global_objects/array/shift/index.html
    @@ -24,7 +24,7 @@
     
     

    Syntax

    -
    arr.shift()
    +
    arr.shift()

    Return value

    @@ -53,7 +53,7 @@

    Removing an element from an array

    The following code displays the myFish array before and after removing its first element. It also displays the removed element:

    -
    var myFish = ['angel', 'clown', 'mandarin', 'surgeon'];
    +
    var myFish = ['angel', 'clown', 'mandarin', 'surgeon'];
     
     console.log('myFish before:', JSON.stringify(myFish));
     // myFish before: ['angel', 'clown', 'mandarin', 'surgeon']
    @@ -73,7 +73,7 @@ 

    Using shift() method in while loop

    -
    var names = ["Andrew", "Edward", "Paul", "Chris" ,"John"];
    +
    var names = ["Andrew", "Edward", "Paul", "Chris" ,"John"];
     
     while( (i = names.shift()) !== undefined ) {
         console.log(i);
    diff --git a/files/en-us/web/javascript/reference/global_objects/array/some/index.html b/files/en-us/web/javascript/reference/global_objects/array/some/index.html
    index 94e55208ee02e8d..7382b14dbd64d24 100644
    --- a/files/en-us/web/javascript/reference/global_objects/array/some/index.html
    +++ b/files/en-us/web/javascript/reference/global_objects/array/some/index.html
    @@ -27,7 +27,7 @@
     

    Syntax

    arr.some(callback(element[, index[, array]])[, thisArg])
    + class="brush: js">arr.some(callback(element[, index[, array]])[, thisArg])

    Parameters

    @@ -104,7 +104,7 @@

    Polyfill

    that fun.call evaluates to the original value of {{jsxref("Function.prototype.call()")}}.

    -
    // Production steps of ECMA-262, Edition 5, 15.4.4.17
    +
    // Production steps of ECMA-262, Edition 5, 15.4.4.17
     // Reference: https://es5.github.io/#x15.4.4.17
     if (!Array.prototype.some) {
       Array.prototype.some = function(fun, thisArg) {
    @@ -138,7 +138,7 @@ 

    Testing value of array elements

    The following example tests whether any element in the array is bigger than 10.

    -
    function isBiggerThan10(element, index, array) {
    +
    function isBiggerThan10(element, index, array) {
       return element > 10;
     }
     
    @@ -151,7 +151,7 @@ 

    Testing array elements usi

    Arrow functions provide a shorter syntax for the same test.

    -
    [2, 5, 8, 1, 4].some(x => x > 10);  // false
    +
    [2, 5, 8, 1, 4].some(x => x > 10);  // false
     [12, 5, 8, 1, 4].some(x => x > 10); // true

    Checking whether a value exists in an @@ -160,7 +160,7 @@

    Checking whether a value ex

    To mimic the function of the includes() method, this custom function returns true if the element exists in the array:

    -
    const fruits = ['apple', 'banana', 'mango', 'guava'];
    +
    const fruits = ['apple', 'banana', 'mango', 'guava'];
     
     function checkAvailability(arr, val) {
       return arr.some(function(arrVal) {
    @@ -174,7 +174,7 @@ 

    Checking whether a value ex

    Checking whether a value exists using an arrow function

    -
    const fruits = ['apple', 'banana', 'mango', 'guava'];
    +
    const fruits = ['apple', 'banana', 'mango', 'guava'];
     
     function checkAvailability(arr, val) {
       return arr.some(arrVal => val === arrVal);
    @@ -185,7 +185,7 @@ 

    Checking whethe

    Converting any value to Boolean

    -
    const TRUTHY_VALUES = [true, 'true', 1];
    +
    const TRUTHY_VALUES = [true, 'true', 1];
     
     function getBoolean(value) {
       'use strict';
    diff --git a/files/en-us/web/javascript/reference/global_objects/array/sort/index.html b/files/en-us/web/javascript/reference/global_objects/array/sort/index.html
    index a63bceb3c533791..b59b3f5408f77e4 100644
    --- a/files/en-us/web/javascript/reference/global_objects/array/sort/index.html
    +++ b/files/en-us/web/javascript/reference/global_objects/array/sort/index.html
    @@ -23,7 +23,7 @@
     
     

    Syntax

    -
    arr.sort([compareFunction])
    +
    arr.sort([compareFunction])
     

    Parameters

    @@ -90,7 +90,7 @@

    Description

    So, the compare function has the following form:

    -
    function compare(a, b) {
    +
    function compare(a, b) {
       if (a is less than b by some ordering criterion) {
         return -1;
       }
    @@ -106,7 +106,7 @@ 

    Description

    from a. The following function will sort the array in ascending order (if it doesn't contain Infinity and NaN):

    -
    function compareNumbers(a, b) {
    +
    function compareNumbers(a, b) {
       return a - b;
     }
     
    @@ -114,7 +114,7 @@

    Description

    The sort method can be conveniently used with {{jsxref("Operators/function", "function expressions", "", 1)}}:

    -
    var numbers = [4, 2, 5, 1, 3];
    +
    var numbers = [4, 2, 5, 1, 3];
     numbers.sort(function(a, b) {
       return a - b;
     });
    @@ -126,7 +126,7 @@ 

    Description

    ES2015 provides {{jsxref("Functions/Arrow_functions", "arrow function expressions", "", 1)}} with even shorter syntax.

    -
    let numbers = [4, 2, 5, 1, 3];
    +
    let numbers = [4, 2, 5, 1, 3];
     numbers.sort((a, b) => a - b);
     console.log(numbers);
     
    @@ -134,7 +134,7 @@ 

    Description

    Arrays of objects can be sorted by comparing the value of one of their properties.

    -
    var items = [
    +
    var items = [
       { name: 'Edward', value: 21 },
       { name: 'Sharpe', value: 37 },
       { name: 'And', value: 45 },
    @@ -172,7 +172,7 @@ 

    Creating, displaying, and sort sorted arrays. The numeric arrays are sorted without a compare function, then sorted using one.

    -
    var stringArray = ['Blue', 'Humpback', 'Beluga'];
    +
    var stringArray = ['Blue', 'Humpback', 'Beluga'];
     var numericStringArray = ['80', '9', '700'];
     var numberArray = [40, 1, 5, 200];
     var mixedNumericArray = ['80', '9', '700', 40, 1, 5, 200];
    @@ -201,7 +201,7 @@ 

    Creating, displaying, and sort function is used, numbers sort correctly whether they are numbers or numeric strings.

    -
    stringArray: Blue,Humpback,Beluga
    +
    stringArray: Blue,Humpback,Beluga
     Sorted: Beluga,Blue,Humpback
     
     numberArray: 40,1,5,200
    @@ -224,7 +224,7 @@ 

    Sorting non-ASCII characters

    {{jsxref("String.localeCompare")}}. This function can compare those characters so they appear in the right order.

    -
    var items = ['réservé', 'premier', 'communiqué', 'café', 'adieu', 'éclair'];
    +
    var items = ['réservé', 'premier', 'communiqué', 'café', 'adieu', 'éclair'];
     items.sort(function (a, b) {
       return a.localeCompare(b);
     });
    @@ -243,7 +243,7 @@ 

    Sorting with map

    sorting into a temporary array, sort the temporary array, and then traverse the temporary array to achieve the right order.

    -
    // the array to be sorted
    +
    // the array to be sorted
     var list = ['Delta', 'alpha', 'CHARLIE', 'bravo'];
     
     // temporary array holds objects with position and sort-value
    diff --git a/files/en-us/web/javascript/reference/global_objects/array/splice/index.html b/files/en-us/web/javascript/reference/global_objects/array/splice/index.html
    index eefbca5f2a4664c..478fc3eec68e9c9 100644
    --- a/files/en-us/web/javascript/reference/global_objects/array/splice/index.html
    +++ b/files/en-us/web/javascript/reference/global_objects/array/splice/index.html
    @@ -27,7 +27,7 @@
     
     

    Syntax

    -
    let arrDeletedItems = arr.splice(start[, deleteCount[, item1[, item2[, ...]]]])
    +
    let arrDeletedItems = arr.splice(start[, deleteCount[, item1[, item2[, ...]]]])
     

    Parameters

    @@ -85,7 +85,7 @@

    Examples

    Remove 0 (zero) elements before index 2, and insert "drum"

    -
    let myFish = ['angel', 'clown', 'mandarin', 'sturgeon']
    +
    let myFish = ['angel', 'clown', 'mandarin', 'sturgeon']
     let removed = myFish.splice(2, 0, 'drum')
     
     // myFish is ["angel", "clown", "drum", "mandarin", "sturgeon"]
    @@ -94,7 +94,7 @@ 

    Remove 0 (zero) e

    Remove 0 (zero) elements before index 2, and insert "drum" and "guitar"

    -
    let myFish = ['angel', 'clown', 'mandarin', 'sturgeon']
    +
    let myFish = ['angel', 'clown', 'mandarin', 'sturgeon']
     let removed = myFish.splice(2, 0, 'drum', 'guitar')
     
     // myFish is ["angel", "clown", "drum", "guitar", "mandarin", "sturgeon"]
    @@ -103,7 +103,7 @@ 

    Remove

    Remove 1 element at index 3

    -
    let myFish = ['angel', 'clown', 'drum', 'mandarin', 'sturgeon']
    +
    let myFish = ['angel', 'clown', 'drum', 'mandarin', 'sturgeon']
     let removed = myFish.splice(3, 1)
     
     // myFish is ["angel", "clown", "drum", "sturgeon"]
    @@ -113,7 +113,7 @@ 

    Remove 1 element at index 3

    Remove 1 element at index 2, and insert "trumpet"

    -
    let myFish = ['angel', 'clown', 'drum', 'sturgeon']
    +
    let myFish = ['angel', 'clown', 'drum', 'sturgeon']
     let removed = myFish.splice(2, 1, 'trumpet')
     
     // myFish is ["angel", "clown", "trumpet", "sturgeon"]
    @@ -122,7 +122,7 @@ 

    Remove 1 element at inde

    Remove 2 elements from index 0, and insert "parrot", "anemone" and "blue"

    -
    let myFish = ['angel', 'clown', 'trumpet', 'sturgeon']
    +
    let myFish = ['angel', 'clown', 'trumpet', 'sturgeon']
     let removed = myFish.splice(0, 2, 'parrot', 'anemone', 'blue')
     
     // myFish is ["parrot", "anemone", "blue", "trumpet", "sturgeon"]
    @@ -130,7 +130,7 @@ 

    Remov

    Remove 2 elements from index 2

    -
    let myFish = ['parrot', 'anemone', 'blue', 'trumpet', 'sturgeon']
    +
    let myFish = ['parrot', 'anemone', 'blue', 'trumpet', 'sturgeon']
     let removed = myFish.splice(2, 2)
     
     // myFish is ["parrot", "anemone", "sturgeon"]
    @@ -138,7 +138,7 @@ 

    Remove 2 elements from index 2

    Remove 1 element from index -2

    -
    let myFish = ['angel', 'clown', 'mandarin', 'sturgeon']
    +
    let myFish = ['angel', 'clown', 'mandarin', 'sturgeon']
     let removed = myFish.splice(-2, 1)
     
     // myFish is ["angel", "clown", "sturgeon"]
    @@ -146,7 +146,7 @@ 

    Remove 1 element from index -2

    Remove all elements from index 2

    -
    let myFish = ['angel', 'clown', 'mandarin', 'sturgeon']
    +
    let myFish = ['angel', 'clown', 'mandarin', 'sturgeon']
     let removed = myFish.splice(2)
     
     // myFish is ["angel", "clown"]
    diff --git a/files/en-us/web/javascript/reference/global_objects/array/tolocalestring/index.html b/files/en-us/web/javascript/reference/global_objects/array/tolocalestring/index.html
    index d82d353313ab3bb..c930f97d4b5ce87 100644
    --- a/files/en-us/web/javascript/reference/global_objects/array/tolocalestring/index.html
    +++ b/files/en-us/web/javascript/reference/global_objects/array/tolocalestring/index.html
    @@ -19,7 +19,7 @@
     
     

    Syntax

    -
    arr.toLocaleString([locales[, options]]);
    +
    arr.toLocaleString([locales[, options]]);
     

    Parameters

    @@ -41,7 +41,7 @@

    Return value

    Polyfill

    -
    // https://tc39.github.io/ecma402/#sup-array.prototype.tolocalestring
    +
    // https://tc39.github.io/ecma402/#sup-array.prototype.tolocalestring
     if (!Array.prototype.toLocaleString) {
       Object.defineProperty(Array.prototype, 'toLocaleString', {
         value: function(locales, options) {
    @@ -145,7 +145,7 @@ 

    Using locales and options

    Always display the currency for the strings and numbers in the prices array:

    -
    var prices = ['¥7', 500, 8123, 12];
    +
    var prices = ['¥7', 500, 8123, 12];
     prices.toLocaleString('ja-JP', { style: 'currency', currency: 'JPY' });
     
     // "¥7,¥500,¥8,123,¥12"
    diff --git a/files/en-us/web/javascript/reference/global_objects/array/tosource/index.html b/files/en-us/web/javascript/reference/global_objects/array/tosource/index.html
    index 84f5e08a43f7267..b38520451a67c15 100644
    --- a/files/en-us/web/javascript/reference/global_objects/array/tosource/index.html
    +++ b/files/en-us/web/javascript/reference/global_objects/array/tosource/index.html
    @@ -16,7 +16,7 @@
     
     

    Syntax

    -
    arr.toSource()
    +
    arr.toSource()

    Return value

    diff --git a/files/en-us/web/javascript/reference/global_objects/array/tostring/index.html b/files/en-us/web/javascript/reference/global_objects/array/tostring/index.html index b0bd6a7c586c2cd..bde782efb164270 100644 --- a/files/en-us/web/javascript/reference/global_objects/array/tostring/index.html +++ b/files/en-us/web/javascript/reference/global_objects/array/tostring/index.html @@ -16,7 +16,7 @@

    Syntax

    -
    arr.toString()
    +
    arr.toString()

    Return value

    @@ -43,7 +43,7 @@

    Examples

    Using toString

    -
    const array1 = [1, 2, 'a', '1a'];
    +
    const array1 = [1, 2, 'a', '1a'];
     
     console.log(array1.toString());
     // expected output: "1,2,a,1a"
    diff --git a/files/en-us/web/javascript/reference/global_objects/array/unshift/index.html b/files/en-us/web/javascript/reference/global_objects/array/unshift/index.html
    index 7c590ae6e0f3253..589789443dca543 100644
    --- a/files/en-us/web/javascript/reference/global_objects/array/unshift/index.html
    +++ b/files/en-us/web/javascript/reference/global_objects/array/unshift/index.html
    @@ -18,7 +18,7 @@
     

    Syntax

    arr.unshift(element1[, ...[, elementN]])
    + class="brush: js">arr.unshift(element1[, ...[, elementN]])

    Parameters

    @@ -52,7 +52,7 @@

    Description

    See example:

    -
    let arr = [4, 5, 6]
    +
    let arr = [4, 5, 6]
     
     arr.unshift(1, 2, 3)
     console.log(arr);
    diff --git a/files/en-us/web/javascript/reference/global_objects/array/values/index.html b/files/en-us/web/javascript/reference/global_objects/array/values/index.html
    index 244daa397c73400..25820504e9924fc 100644
    --- a/files/en-us/web/javascript/reference/global_objects/array/values/index.html
    +++ b/files/en-us/web/javascript/reference/global_objects/array/values/index.html
    @@ -21,7 +21,7 @@
     
     

    Syntax

    -
    arr.values()
    +
    arr.values()

    Return value

    @@ -31,7 +31,7 @@

    Examples

    Iteration using for...of loop

    -
    var arr = ['a', 'b', 'c', 'd', 'e'];
    +
    var arr = ['a', 'b', 'c', 'd', 'e'];
     var iterator = arr.values();
     
     for (let letter of iterator) {
    @@ -43,11 +43,11 @@ 

    Iteration using for...of loop

    Array.prototype[Symbol.iterator].

    Array.prototype.values === Array.prototype[Symbol.iterator]      //true
    + class="brush: js">Array.prototype.values === Array.prototype[Symbol.iterator] //true

    Iteration using .next()

    -
    var arr = ['a', 'b', 'c', 'd', 'e'];
    +
    var arr = ['a', 'b', 'c', 'd', 'e'];
     var iterator = arr.values();
     iterator.next();               // Object { value: "a", done: false }
     iterator.next().value;         // "b"
    @@ -63,7 +63,7 @@ 

    Iteration using .next()

    example:

    -
    var arr = ['a', 'b', 'c', 'd', 'e'];
    +
    var arr = ['a', 'b', 'c', 'd', 'e'];
      var iterator = arr.values();
      for (let letter of iterator) {
      console.log(letter);
    @@ -82,7 +82,7 @@ 

    Iteration using .next()

    object; instead it stores the address of the array used in its creation and so depends on the values stored in that array.

    -
    var arr = ['a', 'b', 'c', 'd', 'e'];
    +
    var arr = ['a', 'b', 'c', 'd', 'e'];
     var iterator = arr.values();
     console.log(iterator);        // Array Iterator {  }
     iterator.next().value;        // "a"
    diff --git a/files/en-us/web/javascript/reference/global_objects/arraybuffer/@@species/index.html b/files/en-us/web/javascript/reference/global_objects/arraybuffer/@@species/index.html
    index bfd5440cbc636bb..3167c00e344e674 100644
    --- a/files/en-us/web/javascript/reference/global_objects/arraybuffer/@@species/index.html
    +++ b/files/en-us/web/javascript/reference/global_objects/arraybuffer/@@species/index.html
    @@ -21,13 +21,13 @@ 

    Species in ordinary objects

    The species property returns the default constructor function, which is the ArrayBuffer constructor for ArrayBuffer objects:

    -
    ArrayBuffer[Symbol.species]; // function ArrayBuffer()
    +
    ArrayBuffer[Symbol.species]; // function ArrayBuffer()

    Species in derived objects

    In a derived collection object (e.g. your custom array buffer MyArrayBuffer), the MyArrayBuffer species is the MyArrayBuffer constructor. However, you might want to overwrite this, in order to return parent ArrayBuffer objects in your derived class methods:

    -
    class MyArrayBuffer extends ArrayBuffer {
    +
    class MyArrayBuffer extends ArrayBuffer {
       // Overwrite MyArrayBuffer species to the parent ArrayBuffer constructor
       static get [Symbol.species]() { return ArrayBuffer; }
     }
    diff --git a/files/en-us/web/javascript/reference/global_objects/arraybuffer/arraybuffer/index.html b/files/en-us/web/javascript/reference/global_objects/arraybuffer/arraybuffer/index.html index 5c6cd0eb59be216..9ea83fab88f9ff9 100644 --- a/files/en-us/web/javascript/reference/global_objects/arraybuffer/arraybuffer/index.html +++ b/files/en-us/web/javascript/reference/global_objects/arraybuffer/arraybuffer/index.html @@ -22,7 +22,7 @@

    Syntax

    -
    new ArrayBuffer(length)
    +
    new ArrayBuffer(length)
     

    Parameters

    @@ -49,11 +49,11 @@

    Compatibility notes

    ArrayBuffer constructor as a function without new, will throw a {{jsxref("TypeError")}} from now on.

    -
    var dv = ArrayBuffer(10);
    +
    var dv = ArrayBuffer(10);
     // TypeError: calling a builtin ArrayBuffer constructor
     // without new is forbidden
    -
    var dv = new ArrayBuffer(10);
    +
    var dv = new ArrayBuffer(10);

    Examples

    @@ -62,7 +62,7 @@

    Creating an ArrayBuffer

    In this example, we create a 8-byte buffer with a {{jsxref("Global_Objects/Int32Array", "Int32Array")}} view referring to the buffer:

    -
    var buffer = new ArrayBuffer(8);
    +
    var buffer = new ArrayBuffer(8);
     var view   = new Int32Array(buffer);

    Specifications

    diff --git a/files/en-us/web/javascript/reference/global_objects/arraybuffer/bytelength/index.html b/files/en-us/web/javascript/reference/global_objects/arraybuffer/bytelength/index.html index 79073253996d202..f66822a115d297c 100644 --- a/files/en-us/web/javascript/reference/global_objects/arraybuffer/bytelength/index.html +++ b/files/en-us/web/javascript/reference/global_objects/arraybuffer/bytelength/index.html @@ -23,7 +23,7 @@

    Examples

    Using byteLength

    -
    var buffer = new ArrayBuffer(8);
    +
    var buffer = new ArrayBuffer(8);
     buffer.byteLength; // 8
     
    diff --git a/files/en-us/web/javascript/reference/global_objects/arraybuffer/isview/index.html b/files/en-us/web/javascript/reference/global_objects/arraybuffer/isview/index.html index 5485e04fca1dae0..b5babf4532c8357 100644 --- a/files/en-us/web/javascript/reference/global_objects/arraybuffer/isview/index.html +++ b/files/en-us/web/javascript/reference/global_objects/arraybuffer/isview/index.html @@ -25,7 +25,7 @@

    Syntax

    -
    ArrayBuffer.isView(value)
    +
    ArrayBuffer.isView(value)

    Parameters

    @@ -43,7 +43,7 @@

    Examples

    Using isView

    -
    ArrayBuffer.isView();                    // false
    +
    ArrayBuffer.isView();                    // false
     ArrayBuffer.isView([]);                  // false
     ArrayBuffer.isView({});                  // false
     ArrayBuffer.isView(null);                // false
    diff --git a/files/en-us/web/javascript/reference/global_objects/arraybuffer/slice/index.html b/files/en-us/web/javascript/reference/global_objects/arraybuffer/slice/index.html
    index 03763cfb00b2f4c..3f6b2934cf6b873 100644
    --- a/files/en-us/web/javascript/reference/global_objects/arraybuffer/slice/index.html
    +++ b/files/en-us/web/javascript/reference/global_objects/arraybuffer/slice/index.html
    @@ -25,7 +25,7 @@
     

    Syntax

    arraybuffer.slice(begin[, end])
    + class="brush: js">arraybuffer.slice(begin[, end])

    Parameters

    @@ -58,7 +58,7 @@

    Examples

    Copying an ArrayBuffer

    -
    const buf1 = new ArrayBuffer(8);
    +
    const buf1 = new ArrayBuffer(8);
     const buf2 = buf1.slice(0);
     
    diff --git a/files/en-us/web/javascript/reference/global_objects/asyncfunction/index.html b/files/en-us/web/javascript/reference/global_objects/asyncfunction/index.html index 1bc7669c21eceb8..cde9a3e4dda9e8b 100644 --- a/files/en-us/web/javascript/reference/global_objects/asyncfunction/index.html +++ b/files/en-us/web/javascript/reference/global_objects/asyncfunction/index.html @@ -21,7 +21,7 @@

    Syntax

    new AsyncFunction([arg1[, arg2[, ...argN]],] functionBody)
    + class="brush: js">new AsyncFunction([arg1[, arg2[, ...argN]],] functionBody)

    Parameters

    diff --git a/files/en-us/web/javascript/reference/global_objects/atomics/add/index.html b/files/en-us/web/javascript/reference/global_objects/atomics/add/index.html index 98c6c3428da7257..f44e51d569eb798 100644 --- a/files/en-us/web/javascript/reference/global_objects/atomics/add/index.html +++ b/files/en-us/web/javascript/reference/global_objects/atomics/add/index.html @@ -24,7 +24,7 @@

    Syntax

    -
    Atomics.add(typedArray, index, value)
    +
    Atomics.add(typedArray, index, value)
     

    Parameters

    @@ -60,7 +60,7 @@

    Examples

    Using add()

    -
    const sab = new SharedArrayBuffer(1024);
    +
    const sab = new SharedArrayBuffer(1024);
     const ta = new Uint8Array(sab);
     
     Atomics.add(ta, 0, 12); // returns 0, the old value
    diff --git a/files/en-us/web/javascript/reference/global_objects/atomics/and/index.html b/files/en-us/web/javascript/reference/global_objects/atomics/and/index.html
    index 404f6f1c1250d39..6a5daaaed43173b 100644
    --- a/files/en-us/web/javascript/reference/global_objects/atomics/and/index.html
    +++ b/files/en-us/web/javascript/reference/global_objects/atomics/and/index.html
    @@ -24,7 +24,7 @@
     
     

    Syntax

    -
    Atomics.and(typedArray, index, value)
    +
    Atomics.and(typedArray, index, value)
     

    Parameters

    @@ -96,7 +96,7 @@

    Description

    For example, a bitwise AND of 5 & 1 results in 0001 which is 1 in decimal.

    -
    5  0101
    +
    5  0101
     1  0001
        ----
     1  0001
    @@ -105,7 +105,7 @@

    Examples

    Using and()

    -
    const sab = new SharedArrayBuffer(1024);
    +
    const sab = new SharedArrayBuffer(1024);
     const ta = new Uint8Array(sab);
     ta[0] = 5;
     
    diff --git a/files/en-us/web/javascript/reference/global_objects/atomics/compareexchange/index.html b/files/en-us/web/javascript/reference/global_objects/atomics/compareexchange/index.html
    index f8e1d8f6ce582bc..ebae895737ba296 100644
    --- a/files/en-us/web/javascript/reference/global_objects/atomics/compareexchange/index.html
    +++ b/files/en-us/web/javascript/reference/global_objects/atomics/compareexchange/index.html
    @@ -26,7 +26,7 @@
     
     

    Syntax

    -
    Atomics.compareExchange(typedArray, index, expectedValue, replacementValue)
    +
    Atomics.compareExchange(typedArray, index, expectedValue, replacementValue)
     

    Parameters

    @@ -64,7 +64,7 @@

    Examples

    Using compareExchange()

    -
    const sab = new SharedArrayBuffer(1024);
    +
    const sab = new SharedArrayBuffer(1024);
     const ta = new Uint8Array(sab);
     ta[0] = 7;
     
    diff --git a/files/en-us/web/javascript/reference/global_objects/atomics/exchange/index.html b/files/en-us/web/javascript/reference/global_objects/atomics/exchange/index.html
    index 0b8e05063ff0d2f..914c50f149e7446 100644
    --- a/files/en-us/web/javascript/reference/global_objects/atomics/exchange/index.html
    +++ b/files/en-us/web/javascript/reference/global_objects/atomics/exchange/index.html
    @@ -24,7 +24,7 @@
     
     

    Syntax

    -
    Atomics.exchange(typedArray, index, value)
    +
    Atomics.exchange(typedArray, index, value)
     

    Parameters

    @@ -60,7 +60,7 @@

    Examples

    Using exchange()

    -
    const sab = new SharedArrayBuffer(1024);
    +
    const sab = new SharedArrayBuffer(1024);
     const ta = new Uint8Array(sab);
     
     Atomics.exchange(ta, 0, 12); // returns 0, the old value
    diff --git a/files/en-us/web/javascript/reference/global_objects/atomics/index.html b/files/en-us/web/javascript/reference/global_objects/atomics/index.html
    index 63ad7a294a43417..bc7ce1b64d3b617 100644
    --- a/files/en-us/web/javascript/reference/global_objects/atomics/index.html
    +++ b/files/en-us/web/javascript/reference/global_objects/atomics/index.html
    @@ -56,7 +56,7 @@ 

    Examples

    Using Atomics

    -
    const sab = new SharedArrayBuffer(1024);
    +
    const sab = new SharedArrayBuffer(1024);
     const ta = new Uint8Array(sab);
     
     ta[0]; // 0
    @@ -95,18 +95,18 @@ 

    Waiting and notifiying

    Given a shared Int32Array:

    -
    const sab = new SharedArrayBuffer(1024);
    +
    const sab = new SharedArrayBuffer(1024);
     const int32 = new Int32Array(sab);
     

    A reading thread is sleeping and waiting on location 0 which is expected to be 0. As long as that is true, it will not go on. However, once the writing thread has stored a new value, it will be notified by the writing thread and return the new value (123).

    -
    Atomics.wait(int32, 0, 0);
    +
    Atomics.wait(int32, 0, 0);
     console.log(int32[0]); // 123

    A writing thread stores a new value and notifies the waiting thread once it has written:

    -
    console.log(int32[0]); // 0;
    +
    console.log(int32[0]); // 0;
     Atomics.store(int32, 0, 123);
     Atomics.notify(int32, 0, 1);
    diff --git a/files/en-us/web/javascript/reference/global_objects/atomics/islockfree/index.html b/files/en-us/web/javascript/reference/global_objects/atomics/islockfree/index.html index a16bf63543daf83..aa3fa5ea6cf2499 100644 --- a/files/en-us/web/javascript/reference/global_objects/atomics/islockfree/index.html +++ b/files/en-us/web/javascript/reference/global_objects/atomics/islockfree/index.html @@ -20,7 +20,7 @@

    Syntax

    -
    Atomics.isLockFree(size)
    +
    Atomics.isLockFree(size)
     

    Parameters

    @@ -38,7 +38,7 @@

    Examples

    Using isLockFree

    -
    Atomics.isLockFree(1); // true
    +
    Atomics.isLockFree(1); // true
     Atomics.isLockFree(2); // true
     Atomics.isLockFree(3); // false
     Atomics.isLockFree(4); // true
    diff --git a/files/en-us/web/javascript/reference/global_objects/atomics/load/index.html b/files/en-us/web/javascript/reference/global_objects/atomics/load/index.html
    index de9a8e524578232..6260c1337acf94d 100644
    --- a/files/en-us/web/javascript/reference/global_objects/atomics/load/index.html
    +++ b/files/en-us/web/javascript/reference/global_objects/atomics/load/index.html
    @@ -16,7 +16,7 @@
     
     

    Syntax

    -
    Atomics.load(typedArray, index)
    +
    Atomics.load(typedArray, index)
     

    Parameters

    @@ -48,7 +48,7 @@

    Examples

    Using load

    -
    const sab = new SharedArrayBuffer(1024);
    +
    const sab = new SharedArrayBuffer(1024);
     const ta = new Uint8Array(sab);
     
     Atomics.add(ta, 0, 12);
    diff --git a/files/en-us/web/javascript/reference/global_objects/atomics/notify/index.html b/files/en-us/web/javascript/reference/global_objects/atomics/notify/index.html
    index 71e4802c135ba81..4b0c5a4b6dc5bfb 100644
    --- a/files/en-us/web/javascript/reference/global_objects/atomics/notify/index.html
    +++ b/files/en-us/web/javascript/reference/global_objects/atomics/notify/index.html
    @@ -20,7 +20,7 @@
     
     

    Syntax

    -
    Atomics.notify(typedArray, index, count)
    +
    Atomics.notify(typedArray, index, count)
     

    Parameters

    @@ -58,7 +58,7 @@

    Using notify

    Given a shared Int32Array:

    -
    const sab = new SharedArrayBuffer(1024);
    +
    const sab = new SharedArrayBuffer(1024);
     const int32 = new Int32Array(sab);
     
    @@ -66,13 +66,13 @@

    Using notify

    long as that is true, it will not go on. However, once the writing thread has stored a new value, it will be notified by the writing thread and return the new value (123).

    -
    Atomics.wait(int32, 0, 0);
    +
    Atomics.wait(int32, 0, 0);
     console.log(int32[0]); // 123

    A writing thread stores a new value and notifies the waiting thread once it has written:

    -
    console.log(int32[0]); // 0;
    +
    console.log(int32[0]); // 0;
     Atomics.store(int32, 0, 123);
     Atomics.notify(int32, 0, 1);
    diff --git a/files/en-us/web/javascript/reference/global_objects/atomics/or/index.html b/files/en-us/web/javascript/reference/global_objects/atomics/or/index.html index 1679287fa59ab1d..224d144ef590de6 100644 --- a/files/en-us/web/javascript/reference/global_objects/atomics/or/index.html +++ b/files/en-us/web/javascript/reference/global_objects/atomics/or/index.html @@ -24,7 +24,7 @@

    Syntax

    -
    Atomics.or(typedArray, index, value)
    +
    Atomics.or(typedArray, index, value)
     

    Parameters

    @@ -96,7 +96,7 @@

    Description

    For example, a bitwise OR of 5 | 1 results in 0101 which is 5 in decimal.

    -
    5  0101
    +
    5  0101
     1  0001
        ----
     5  0101
    @@ -106,7 +106,7 @@ 

    Examples

    Using or

    -
    const sab = new SharedArrayBuffer(1024);
    +
    const sab = new SharedArrayBuffer(1024);
     const ta = new Uint8Array(sab);
     ta[0] = 2;
     
    diff --git a/files/en-us/web/javascript/reference/global_objects/atomics/store/index.html b/files/en-us/web/javascript/reference/global_objects/atomics/store/index.html
    index 4db079ba53d11ab..8b724629547d26f 100644
    --- a/files/en-us/web/javascript/reference/global_objects/atomics/store/index.html
    +++ b/files/en-us/web/javascript/reference/global_objects/atomics/store/index.html
    @@ -23,7 +23,7 @@
     
     

    Syntax

    -
    Atomics.store(typedArray, index, value)
    +
    Atomics.store(typedArray, index, value)
     

    Parameters

    @@ -58,7 +58,7 @@

    Examples

    Using store()

    -
    var sab = new SharedArrayBuffer(1024);
    +
    var sab = new SharedArrayBuffer(1024);
     var ta = new Uint8Array(sab);
     
     Atomics.store(ta, 0, 12); // 12
    diff --git a/files/en-us/web/javascript/reference/global_objects/atomics/sub/index.html b/files/en-us/web/javascript/reference/global_objects/atomics/sub/index.html index a903550289a799b..ba31234c577a731 100644 --- a/files/en-us/web/javascript/reference/global_objects/atomics/sub/index.html +++ b/files/en-us/web/javascript/reference/global_objects/atomics/sub/index.html @@ -18,7 +18,7 @@

    Syntax

    -
    Atomics.sub(typedArray, index, value)
    +
    Atomics.sub(typedArray, index, value)
     

    Parameters

    @@ -54,7 +54,7 @@

    Examples

    Using sub

    -
    const sab = new SharedArrayBuffer(1024);
    +
    const sab = new SharedArrayBuffer(1024);
     const ta = new Uint8Array(sab);
     ta[0] = 48;
     
    diff --git a/files/en-us/web/javascript/reference/global_objects/atomics/wait/index.html b/files/en-us/web/javascript/reference/global_objects/atomics/wait/index.html
    index 31f61593813f74a..dcfc235b2b6ae42 100644
    --- a/files/en-us/web/javascript/reference/global_objects/atomics/wait/index.html
    +++ b/files/en-us/web/javascript/reference/global_objects/atomics/wait/index.html
    @@ -21,7 +21,7 @@
     
     

    Syntax

    -
    Atomics.wait(typedArray, index, value[, timeout])
    +
    Atomics.wait(typedArray, index, value[, timeout])
     

    Parameters

    @@ -57,7 +57,7 @@

    Using wait()

    Given a shared Int32Array:

    -
    const sab = new SharedArrayBuffer(1024);
    +
    const sab = new SharedArrayBuffer(1024);
     const int32 = new Int32Array(sab);
     
    @@ -65,13 +65,13 @@

    Using wait()

    long as that is true, it will not go on. However, once the writing thread has stored a new value, it will be notified by the writing thread and return the new value (123).

    -
    Atomics.wait(int32, 0, 0);
    +
    Atomics.wait(int32, 0, 0);
     console.log(int32[0]); // 123

    A writing thread stores a new value and notifies the waiting thread once it has written:

    -
    console.log(int32[0]); // 0;
    +
    console.log(int32[0]); // 0;
     Atomics.store(int32, 0, 123);
     Atomics.notify(int32, 0, 1);
    diff --git a/files/en-us/web/javascript/reference/global_objects/atomics/xor/index.html b/files/en-us/web/javascript/reference/global_objects/atomics/xor/index.html index 661c630606aba70..a3de5ddc51d51b2 100644 --- a/files/en-us/web/javascript/reference/global_objects/atomics/xor/index.html +++ b/files/en-us/web/javascript/reference/global_objects/atomics/xor/index.html @@ -18,7 +18,7 @@

    Syntax

    -
    Atomics.xor(typedArray, index, value)
    +
    Atomics.xor(typedArray, index, value)
     

    Parameters

    @@ -88,7 +88,7 @@

    Description

    For example, a bitwise XOR of 5 ^ 1 results in 0100 which is 4 in decimal.

    -
    5  0101
    +
    5  0101
     1  0001
        ----
     4  0100
    @@ -98,7 +98,7 @@ 

    Examples

    Using xor

    -
    const sab = new SharedArrayBuffer(1024);
    +
    const sab = new SharedArrayBuffer(1024);
     const ta = new Uint8Array(sab);
     ta[0] = 5;
     
    diff --git a/files/en-us/web/javascript/reference/global_objects/bigint/asintn/index.html b/files/en-us/web/javascript/reference/global_objects/bigint/asintn/index.html
    index d2ef9967fba6e13..af3fbfcb259fe76 100644
    --- a/files/en-us/web/javascript/reference/global_objects/bigint/asintn/index.html
    +++ b/files/en-us/web/javascript/reference/global_objects/bigint/asintn/index.html
    @@ -24,7 +24,7 @@
     

    Syntax

    BigInt.asIntN(width, bigint);
    + class="brush: js">BigInt.asIntN(width, bigint);

    Parameters

    diff --git a/files/en-us/web/javascript/reference/global_objects/bigint/asuintn/index.html b/files/en-us/web/javascript/reference/global_objects/bigint/asuintn/index.html index 0f26c4fa707bf9f..321997239849952 100644 --- a/files/en-us/web/javascript/reference/global_objects/bigint/asuintn/index.html +++ b/files/en-us/web/javascript/reference/global_objects/bigint/asuintn/index.html @@ -24,7 +24,7 @@

    Syntax

    BigInt.asUintN(width, bigint);
    + class="brush: js">BigInt.asUintN(width, bigint);

    Parameters

    diff --git a/files/en-us/web/javascript/reference/global_objects/bigint/bigint/index.html b/files/en-us/web/javascript/reference/global_objects/bigint/bigint/index.html index 952c67cb5ba6636..bfebb3c049700c4 100644 --- a/files/en-us/web/javascript/reference/global_objects/bigint/bigint/index.html +++ b/files/en-us/web/javascript/reference/global_objects/bigint/bigint/index.html @@ -14,7 +14,7 @@

    Syntax

    -
    BigInt(value);
    +
    BigInt(value);
     

    Parameters

    diff --git a/files/en-us/web/javascript/reference/global_objects/bigint/index.html b/files/en-us/web/javascript/reference/global_objects/bigint/index.html index 4098f54ef7a283c..88ffd274b96536a 100644 --- a/files/en-us/web/javascript/reference/global_objects/bigint/index.html +++ b/files/en-us/web/javascript/reference/global_objects/bigint/index.html @@ -15,7 +15,7 @@

    Description

    A BigInt is created by appending n to the end of an integer literal — 10n — or by calling the function BigInt().

    -
    const previouslyMaxSafeInteger = 9007199254740991n
    +
    const previouslyMaxSafeInteger = 9007199254740991n
     
     const alsoHuge = BigInt(9007199254740991)
     // ↪ 9007199254740991n
    @@ -39,13 +39,13 @@ 

    Type information

    When tested against typeof, a BigInt will give "bigint":

    -
    typeof 1n === 'bigint'           // true
    +
    typeof 1n === 'bigint'           // true
     typeof BigInt('1') === 'bigint'  // true
     

    When wrapped in an Object, a BigInt will be considered as a normal "object" type:

    -
    typeof Object(1n) === 'object'  // true
    +
    typeof Object(1n) === 'object'  // true
     

    Operators

    @@ -56,7 +56,7 @@

    Operators

    Also unsupported is the unary operator (+), in order to not break asm.js.

    -
    const previousMaxSafe = BigInt(Number.MAX_SAFE_INTEGER)
    +
    const previousMaxSafe = BigInt(Number.MAX_SAFE_INTEGER)
     // ↪ 9007199254740991n
     
     const maxPlusOne = previousMaxSafe + 1n
    @@ -89,7 +89,7 @@ 

    Operators

    An operation with a fractional result will be truncated when used with a BigInt.

    -
    const expected = 4n / 2n
    +
    const expected = 4n / 2n
     // ↪ 2n
     
     const rounded = 5n / 2n
    @@ -101,7 +101,7 @@ 

    Comparisons

    A BigInt is not strictly equal to a Number, but it is loosely so:

    -
    0n === 0
    +
    0n === 0
     // ↪ false
     
     0n == 0
    @@ -109,7 +109,7 @@ 

    Comparisons

    A Number and a BigInt may be compared as usual:

    -
    1n < 2
    +
    1n < 2
     // ↪ true
     
     2n > 1
    @@ -126,7 +126,7 @@ 

    Comparisons

    They may be mixed in arrays and sorted:

    -
    const mixed = [4n, 6, -12n, 10, 4, 0, 0n]
    +
    const mixed = [4n, 6, -12n, 10, 4, 0, 0n]
     // ↪  [4n, 6, -12n, 10, 4, 0, 0n]
     
     mixed.sort() // default sorting behavior
    @@ -143,7 +143,7 @@ 

    Comparisons

    Note that comparisons with Object-wrapped BigInts act as with other objects, only indicating equality when the same object instance is compared:

    -
    0n === Object(0n)          // false
    +
    0n === Object(0n)          // false
     Object(0n) === Object(0n)  // false
     
     const o = Object(0n)
    @@ -160,7 +160,7 @@ 

    Conditionals

  • within a conditional test like an if statement.
-
if (0n) {
+
if (0n) {
   console.log('Hello from the if!')
 } else {
   console.log('Hello from the else!')
@@ -228,18 +228,18 @@ 

Use within JSON

Using JSON.stringify() with any BigInt value will raise a TypeError as BigInt values aren't serialized in JSON by default. However, you can implement your own toJSON method if needed:

-
BigInt.prototype.toJSON = function() { return this.toString()  }
+
BigInt.prototype.toJSON = function() { return this.toString()  }

Instead of throwing, JSON.stringify now produces a string like this:

-
JSON.stringify(BigInt(1))
+
JSON.stringify(BigInt(1))
 // '"1"'

Examples

Calculating Primes

-
// Returns true if passed BigInt is a prime number
+
// Returns true if passed BigInt is a prime number
 function isPrime(p) {
   for (let i = 2n; i * i <= p; i++) {
     if (p % i === 0n) return false;
diff --git a/files/en-us/web/javascript/reference/global_objects/bigint/tolocalestring/index.html b/files/en-us/web/javascript/reference/global_objects/bigint/tolocalestring/index.html
index 287ee3d688e57ef..9e6e898396be44f 100644
--- a/files/en-us/web/javascript/reference/global_objects/bigint/tolocalestring/index.html
+++ b/files/en-us/web/javascript/reference/global_objects/bigint/tolocalestring/index.html
@@ -19,7 +19,7 @@
 

Syntax

bigIntObj.toLocaleString([locales [, options]])
+ class="brush: js">bigIntObj.toLocaleString([locales [, options]])

Parameters

diff --git a/files/en-us/web/javascript/reference/global_objects/bigint/tostring/index.html b/files/en-us/web/javascript/reference/global_objects/bigint/tostring/index.html index 4195bc93a3a9a04..2b851250e657788 100644 --- a/files/en-us/web/javascript/reference/global_objects/bigint/tostring/index.html +++ b/files/en-us/web/javascript/reference/global_objects/bigint/tostring/index.html @@ -18,7 +18,7 @@

Syntax

bigIntObj.toString([radix])
+ class="brush: js">bigIntObj.toString([radix])

Parameters

diff --git a/files/en-us/web/javascript/reference/global_objects/bigint/valueof/index.html b/files/en-us/web/javascript/reference/global_objects/bigint/valueof/index.html index b951ae6402568c7..92298b982e71691 100644 --- a/files/en-us/web/javascript/reference/global_objects/bigint/valueof/index.html +++ b/files/en-us/web/javascript/reference/global_objects/bigint/valueof/index.html @@ -17,7 +17,7 @@

Syntax

-
bigIntObj.valueOf()
+
bigIntObj.valueOf()

Return value

diff --git a/files/en-us/web/javascript/reference/global_objects/biguint64array/biguint64array/index.html b/files/en-us/web/javascript/reference/global_objects/biguint64array/biguint64array/index.html index a4a514e6b9fdbd3..cbfa501ddd63d5f 100644 --- a/files/en-us/web/javascript/reference/global_objects/biguint64array/biguint64array/index.html +++ b/files/en-us/web/javascript/reference/global_objects/biguint64array/biguint64array/index.html @@ -20,7 +20,7 @@

Syntax

new BigUint64Array();
+  class="brush: js">new BigUint64Array();
 new BigUint64Array(length);
 new BigUint64Array(typedArray);
 new BigUint64Array(object);
diff --git a/files/en-us/web/javascript/reference/global_objects/boolean/boolean/index.html b/files/en-us/web/javascript/reference/global_objects/boolean/boolean/index.html
index 029c20cf3a1c94f..81c1276884b65a8 100644
--- a/files/en-us/web/javascript/reference/global_objects/boolean/boolean/index.html
+++ b/files/en-us/web/javascript/reference/global_objects/boolean/boolean/index.html
@@ -16,7 +16,7 @@
 
 

Syntax

-
new Boolean([value])
+
new Boolean([value])

Parameters

diff --git a/files/en-us/web/javascript/reference/global_objects/boolean/index.html b/files/en-us/web/javascript/reference/global_objects/boolean/index.html index dc5036ba80cda1a..8dcca4c200ce2e4 100644 --- a/files/en-us/web/javascript/reference/global_objects/boolean/index.html +++ b/files/en-us/web/javascript/reference/global_objects/boolean/index.html @@ -19,7 +19,7 @@

Description

Any object of which the value is not {{jsxref("undefined")}} or {{jsxref("null")}}, including a Boolean object whose value is false, evaluates to true when passed to a conditional statement. For example, the condition in the following {{jsxref("Statements/if...else", "if")}} statement evaluates to true:

-
var x = new Boolean(false);
+
var x = new Boolean(false);
 if (x) {
   // this code is executed
 }
@@ -27,7 +27,7 @@ 

Description

This behavior does not apply to Boolean primitives. For example, the condition in the following {{jsxref("Statements/if...else", "if")}} statement evaluates to false:

-
var x = false;
+
var x = false;
 if (x) {
   // this code is not executed
 }
@@ -35,14 +35,14 @@ 

Description

Do not use a Boolean object to convert a non-boolean value to a boolean value. To perform this task, instead, use Boolean as a function, or a double NOT operator:

-
var x = Boolean(expression);     // use this...
+
var x = Boolean(expression);     // use this...
 var x = !!(expression);          // ...or this
 var x = new Boolean(expression); // don't use this!
 

If you specify any object, including a Boolean object whose value is false, as the initial value of a Boolean object, the new Boolean object has a value of true.

-
var myFalse = new Boolean(false);   // initial value of false
+
var myFalse = new Boolean(false);   // initial value of false
 var g = Boolean(myFalse);       // initial value of true
 var myString = new String('Hello'); // string object
 var s = Boolean(myString);      // initial value of true
@@ -74,7 +74,7 @@ 

Examples

Creating Boolean objects with an initial value of false

-
var bNoParam = new Boolean();
+
var bNoParam = new Boolean();
 var bZero = new Boolean(0);
 var bNull = new Boolean(null);
 var bEmptyString = new Boolean('');
@@ -83,7 +83,7 @@ 

Creating Boolea

Creating Boolean objects with an initial value of true

-
var btrue = new Boolean(true);
+
var btrue = new Boolean(true);
 var btrueString = new Boolean('true');
 var bfalseString = new Boolean('false');
 var bSuLin = new Boolean('Su Lin');
diff --git a/files/en-us/web/javascript/reference/global_objects/boolean/tosource/index.html b/files/en-us/web/javascript/reference/global_objects/boolean/tosource/index.html
index 7e3b750d50d0123..90551f84c3c3d34 100644
--- a/files/en-us/web/javascript/reference/global_objects/boolean/tosource/index.html
+++ b/files/en-us/web/javascript/reference/global_objects/boolean/tosource/index.html
@@ -17,7 +17,7 @@
 
 

Syntax

-
booleanObj.toSource()
+
booleanObj.toSource()
 Boolean.toSource()

Return value

diff --git a/files/en-us/web/javascript/reference/global_objects/boolean/tostring/index.html b/files/en-us/web/javascript/reference/global_objects/boolean/tostring/index.html index a4e480381eada01..2c286d5cd67b3ed 100644 --- a/files/en-us/web/javascript/reference/global_objects/boolean/tostring/index.html +++ b/files/en-us/web/javascript/reference/global_objects/boolean/tostring/index.html @@ -17,7 +17,7 @@

Syntax

-
bool.toString()
+
bool.toString()

Return value

@@ -44,7 +44,7 @@

Using toString()

In the following code, flag.toString() returns "true":

-
var flag = new Boolean(true);
+
var flag = new Boolean(true);
 var myVar = flag.toString();
 
diff --git a/files/en-us/web/javascript/reference/global_objects/boolean/valueof/index.html b/files/en-us/web/javascript/reference/global_objects/boolean/valueof/index.html index bbec1f7e0254021..986231f36e7de91 100644 --- a/files/en-us/web/javascript/reference/global_objects/boolean/valueof/index.html +++ b/files/en-us/web/javascript/reference/global_objects/boolean/valueof/index.html @@ -17,7 +17,7 @@

Syntax

-
bool.valueOf()
+
bool.valueOf()

Return value

@@ -35,7 +35,7 @@

Examples

Using valueOf()

-
x = new Boolean();
+
x = new Boolean();
 myVar = x.valueOf(); // assigns false to myVar
 
diff --git a/files/en-us/web/javascript/reference/global_objects/dataview/buffer/index.html b/files/en-us/web/javascript/reference/global_objects/dataview/buffer/index.html index 08556a965eaae0e..35c642abff60b76 100644 --- a/files/en-us/web/javascript/reference/global_objects/dataview/buffer/index.html +++ b/files/en-us/web/javascript/reference/global_objects/dataview/buffer/index.html @@ -24,7 +24,7 @@

Examples

Using the buffer property

-
var buffer = new ArrayBuffer(8);
+
var buffer = new ArrayBuffer(8);
 var dataview = new DataView(buffer);
 dataview.buffer; // ArrayBuffer { byteLength: 8 }
 
diff --git a/files/en-us/web/javascript/reference/global_objects/dataview/bytelength/index.html b/files/en-us/web/javascript/reference/global_objects/dataview/bytelength/index.html index 5ce0b0a7bfd4b27..de043af384af8c7 100644 --- a/files/en-us/web/javascript/reference/global_objects/dataview/bytelength/index.html +++ b/files/en-us/web/javascript/reference/global_objects/dataview/bytelength/index.html @@ -24,7 +24,7 @@

Examples

Using the byteLength property

-
var buffer = new ArrayBuffer(8);
+
var buffer = new ArrayBuffer(8);
 var dataview = new DataView(buffer);
 dataview.byteLength; // 8 (matches the byteLength of the buffer)
 
diff --git a/files/en-us/web/javascript/reference/global_objects/dataview/byteoffset/index.html b/files/en-us/web/javascript/reference/global_objects/dataview/byteoffset/index.html
index cd0b534bfb6bbe5..bfc29e409567ee9 100644
--- a/files/en-us/web/javascript/reference/global_objects/dataview/byteoffset/index.html
+++ b/files/en-us/web/javascript/reference/global_objects/dataview/byteoffset/index.html
@@ -24,7 +24,7 @@ 

Examples

Using the byteOffset property

-
var buffer = new ArrayBuffer(8);
+
var buffer = new ArrayBuffer(8);
 var dataview = new DataView(buffer);
 dataview.byteOffset; // 0 (no offset specified)
 
diff --git a/files/en-us/web/javascript/reference/global_objects/dataview/dataview/index.html b/files/en-us/web/javascript/reference/global_objects/dataview/dataview/index.html
index ffaf21beca73bf6..bfb44415d46ef94 100644
--- a/files/en-us/web/javascript/reference/global_objects/dataview/dataview/index.html
+++ b/files/en-us/web/javascript/reference/global_objects/dataview/dataview/index.html
@@ -24,7 +24,7 @@
 

Syntax

new DataView(buffer [, byteOffset [, byteLength]])
+ class="brush: js">new DataView(buffer [, byteOffset [, byteLength]])

Parameters

@@ -68,7 +68,7 @@

Examples

Using DataView

-
var buffer = new ArrayBuffer(16);
+
var buffer = new ArrayBuffer(16);
 var view = new DataView(buffer, 0);
 
 view.setInt16(1, 42);
diff --git a/files/en-us/web/javascript/reference/global_objects/dataview/getbigint64/index.html b/files/en-us/web/javascript/reference/global_objects/dataview/getbigint64/index.html
index f130d3659e3fd56..abb7774312550de 100644
--- a/files/en-us/web/javascript/reference/global_objects/dataview/getbigint64/index.html
+++ b/files/en-us/web/javascript/reference/global_objects/dataview/getbigint64/index.html
@@ -22,7 +22,7 @@
 

Syntax

dataview.getBigInt64(byteOffset [, littleEndian])
+ class="brush: js">dataview.getBigInt64(byteOffset [, littleEndian])

Parameters

diff --git a/files/en-us/web/javascript/reference/global_objects/dataview/getbiguint64/index.html b/files/en-us/web/javascript/reference/global_objects/dataview/getbiguint64/index.html index 16a950098081505..c153a3c839818b1 100644 --- a/files/en-us/web/javascript/reference/global_objects/dataview/getbiguint64/index.html +++ b/files/en-us/web/javascript/reference/global_objects/dataview/getbiguint64/index.html @@ -22,7 +22,7 @@

Syntax

dataview.getBigUint64(byteOffset [, littleEndian])
+ class="brush: js">dataview.getBigUint64(byteOffset [, littleEndian])

Parameters

diff --git a/files/en-us/web/javascript/reference/global_objects/dataview/getfloat32/index.html b/files/en-us/web/javascript/reference/global_objects/dataview/getfloat32/index.html index 3b6f8b227813c59..0a3b123ce67035b 100644 --- a/files/en-us/web/javascript/reference/global_objects/dataview/getfloat32/index.html +++ b/files/en-us/web/javascript/reference/global_objects/dataview/getfloat32/index.html @@ -24,7 +24,7 @@

Syntax

dataview.getFloat32(byteOffset [, littleEndian])
+ class="brush: js">dataview.getFloat32(byteOffset [, littleEndian])

Parameters

@@ -57,7 +57,7 @@

Examples

Using the getFloat32 method

-
var buffer = new ArrayBuffer(8);
+
var buffer = new ArrayBuffer(8);
 var dataview = new DataView(buffer);
 dataview.getFloat32(1); // 0
 
diff --git a/files/en-us/web/javascript/reference/global_objects/dataview/getfloat64/index.html b/files/en-us/web/javascript/reference/global_objects/dataview/getfloat64/index.html index 22d29c4b1dbc0dd..79bf6fe716eb958 100644 --- a/files/en-us/web/javascript/reference/global_objects/dataview/getfloat64/index.html +++ b/files/en-us/web/javascript/reference/global_objects/dataview/getfloat64/index.html @@ -24,7 +24,7 @@

Syntax

dataview.getFloat64(byteOffset [, littleEndian])
+ class="brush: js">dataview.getFloat64(byteOffset [, littleEndian])

Parameters

@@ -57,7 +57,7 @@

Examples

Using the getFloat64 method

-
var buffer = new ArrayBuffer(8);
+
var buffer = new ArrayBuffer(8);
 var dataview = new DataView(buffer);
 dataview.getFloat64(0); // 0
 
diff --git a/files/en-us/web/javascript/reference/global_objects/dataview/getint16/index.html b/files/en-us/web/javascript/reference/global_objects/dataview/getint16/index.html index d348f7a5e9fd713..3368dcc4d3cec3f 100644 --- a/files/en-us/web/javascript/reference/global_objects/dataview/getint16/index.html +++ b/files/en-us/web/javascript/reference/global_objects/dataview/getint16/index.html @@ -24,7 +24,7 @@

Syntax

dataview.getInt16(byteOffset [, littleEndian])
+ class="brush: js">dataview.getInt16(byteOffset [, littleEndian])

Parameters

@@ -57,7 +57,7 @@

Examples

Using the getInt16 method

-
var buffer = new ArrayBuffer(8);
+
var buffer = new ArrayBuffer(8);
 var dataview = new DataView(buffer);
 dataview.getInt16(1); // 0
 
diff --git a/files/en-us/web/javascript/reference/global_objects/dataview/getint32/index.html b/files/en-us/web/javascript/reference/global_objects/dataview/getint32/index.html index 75ae86761e149d1..274a30287513cb2 100644 --- a/files/en-us/web/javascript/reference/global_objects/dataview/getint32/index.html +++ b/files/en-us/web/javascript/reference/global_objects/dataview/getint32/index.html @@ -24,7 +24,7 @@

Syntax

dataview.getInt32(byteOffset [, littleEndian])
+ class="brush: js">dataview.getInt32(byteOffset [, littleEndian])

Parameters

@@ -57,7 +57,7 @@

Examples

Using the getInt32 method

-
var buffer = new ArrayBuffer(8);
+
var buffer = new ArrayBuffer(8);
 var dataview = new DataView(buffer);
 dataview.getInt32(1); // 0
 
diff --git a/files/en-us/web/javascript/reference/global_objects/dataview/getint8/index.html b/files/en-us/web/javascript/reference/global_objects/dataview/getint8/index.html index d927b58808cf8fe..d094993cfda5861 100644 --- a/files/en-us/web/javascript/reference/global_objects/dataview/getint8/index.html +++ b/files/en-us/web/javascript/reference/global_objects/dataview/getint8/index.html @@ -24,7 +24,7 @@

Syntax

dataview.getInt8(byteOffset)
+ class="brush: js">dataview.getInt8(byteOffset)

Parameters

@@ -53,7 +53,7 @@

Examples

Using the getInt8 method

-
var buffer = new ArrayBuffer(8);
+
var buffer = new ArrayBuffer(8);
 var dataview = new DataView(buffer);
 dataview.getInt8(1); // 0
 
diff --git a/files/en-us/web/javascript/reference/global_objects/dataview/getuint16/index.html b/files/en-us/web/javascript/reference/global_objects/dataview/getuint16/index.html index 5ebe58bb5ccf339..88e614fa56756b7 100644 --- a/files/en-us/web/javascript/reference/global_objects/dataview/getuint16/index.html +++ b/files/en-us/web/javascript/reference/global_objects/dataview/getuint16/index.html @@ -25,7 +25,7 @@

Syntax

dataview.getUint16(byteOffset [, littleEndian])
+ class="brush: js">dataview.getUint16(byteOffset [, littleEndian])

Parameters

@@ -58,7 +58,7 @@

Examples

Using the getUint16 method

-
var buffer = new ArrayBuffer(8);
+
var buffer = new ArrayBuffer(8);
 var dataview = new DataView(buffer);
 dataview.getUint16(1); // 0
 
diff --git a/files/en-us/web/javascript/reference/global_objects/dataview/getuint32/index.html b/files/en-us/web/javascript/reference/global_objects/dataview/getuint32/index.html index aba00e0f998a63d..4a340695f618bb5 100644 --- a/files/en-us/web/javascript/reference/global_objects/dataview/getuint32/index.html +++ b/files/en-us/web/javascript/reference/global_objects/dataview/getuint32/index.html @@ -25,7 +25,7 @@

Syntax

dataview.getUint32(byteOffset [, littleEndian])
+ class="brush: js">dataview.getUint32(byteOffset [, littleEndian])

Parameters

@@ -58,7 +58,7 @@

Examples

Using the getUint32 method

-
var buffer = new ArrayBuffer(8);
+
var buffer = new ArrayBuffer(8);
 var dataview = new DataView(buffer);
 dataview.getUint32(1); // 0
 
diff --git a/files/en-us/web/javascript/reference/global_objects/dataview/getuint8/index.html b/files/en-us/web/javascript/reference/global_objects/dataview/getuint8/index.html index dbf28e654c9fdb4..c7ede6266ec2064 100644 --- a/files/en-us/web/javascript/reference/global_objects/dataview/getuint8/index.html +++ b/files/en-us/web/javascript/reference/global_objects/dataview/getuint8/index.html @@ -25,7 +25,7 @@

Syntax

dataview.getUint8(byteOffset)
+ class="brush: js">dataview.getUint8(byteOffset)

Parameters

@@ -54,7 +54,7 @@

Examples

Using the getUint8 method

-
var buffer = new ArrayBuffer(8);
+
var buffer = new ArrayBuffer(8);
 var dataview = new DataView(buffer);
 dataview.getUint8(1); // 0
 
diff --git a/files/en-us/web/javascript/reference/global_objects/dataview/setbigint64/index.html b/files/en-us/web/javascript/reference/global_objects/dataview/setbigint64/index.html index e57c566fb86cddc..2619bcf22a5bf55 100644 --- a/files/en-us/web/javascript/reference/global_objects/dataview/setbigint64/index.html +++ b/files/en-us/web/javascript/reference/global_objects/dataview/setbigint64/index.html @@ -22,7 +22,7 @@

Syntax

dataview.setBigInt64(byteOffset, value [, littleEndian])
+ class="brush: js">dataview.setBigInt64(byteOffset, value [, littleEndian])

Parameters

diff --git a/files/en-us/web/javascript/reference/global_objects/dataview/setbiguint64/index.html b/files/en-us/web/javascript/reference/global_objects/dataview/setbiguint64/index.html index c5063f869ba635e..3bb2e77959b8a12 100644 --- a/files/en-us/web/javascript/reference/global_objects/dataview/setbiguint64/index.html +++ b/files/en-us/web/javascript/reference/global_objects/dataview/setbiguint64/index.html @@ -22,7 +22,7 @@

Syntax

dataview.setBigUint64(byteOffset, value [, littleEndian])
+ class="brush: js">dataview.setBigUint64(byteOffset, value [, littleEndian])

Parameters

diff --git a/files/en-us/web/javascript/reference/global_objects/dataview/setfloat32/index.html b/files/en-us/web/javascript/reference/global_objects/dataview/setfloat32/index.html index e2c0cc8ff1c1d5b..f6be3269007db83 100644 --- a/files/en-us/web/javascript/reference/global_objects/dataview/setfloat32/index.html +++ b/files/en-us/web/javascript/reference/global_objects/dataview/setfloat32/index.html @@ -25,7 +25,7 @@

Syntax

dataview.setFloat32(byteOffset, value [, littleEndian])
+ class="brush: js">dataview.setFloat32(byteOffset, value [, littleEndian])

Parameters

@@ -56,7 +56,7 @@

Examples

Using the setFloat32 method

-
var buffer = new ArrayBuffer(8);
+
var buffer = new ArrayBuffer(8);
 var dataview = new DataView(buffer);
 dataview.setFloat32(1, 3);
 dataview.getFloat32(1); // 3
diff --git a/files/en-us/web/javascript/reference/global_objects/dataview/setfloat64/index.html b/files/en-us/web/javascript/reference/global_objects/dataview/setfloat64/index.html
index 9dde62b99425f10..6da4ce37d7faf80 100644
--- a/files/en-us/web/javascript/reference/global_objects/dataview/setfloat64/index.html
+++ b/files/en-us/web/javascript/reference/global_objects/dataview/setfloat64/index.html
@@ -25,7 +25,7 @@
 

Syntax

dataview.setFloat64(byteOffset, value [, littleEndian])
+ class="brush: js">dataview.setFloat64(byteOffset, value [, littleEndian])

Parameters

@@ -56,7 +56,7 @@

Examples

Using the setFloat64 method

-
var buffer = new ArrayBuffer(8);
+
var buffer = new ArrayBuffer(8);
 var dataview = new DataView(buffer);
 dataview.setFloat64(0, 3);
 dataview.getFloat64(0); // 3
diff --git a/files/en-us/web/javascript/reference/global_objects/dataview/setint16/index.html b/files/en-us/web/javascript/reference/global_objects/dataview/setint16/index.html
index 27e278602ca6c6a..929937a2b2808ee 100644
--- a/files/en-us/web/javascript/reference/global_objects/dataview/setint16/index.html
+++ b/files/en-us/web/javascript/reference/global_objects/dataview/setint16/index.html
@@ -25,7 +25,7 @@
 

Syntax

dataview.setInt16(byteOffset, value [, littleEndian])
+ class="brush: js">dataview.setInt16(byteOffset, value [, littleEndian])

Parameters

@@ -56,7 +56,7 @@

Examples

Using the setInt16 method

-
var buffer = new ArrayBuffer(8);
+
var buffer = new ArrayBuffer(8);
 var dataview = new DataView(buffer);
 dataview.setInt16(1, 3);
 dataview.getInt16(1); // 3
diff --git a/files/en-us/web/javascript/reference/global_objects/dataview/setint32/index.html b/files/en-us/web/javascript/reference/global_objects/dataview/setint32/index.html
index 2b73808a4634a13..cff858165db0793 100644
--- a/files/en-us/web/javascript/reference/global_objects/dataview/setint32/index.html
+++ b/files/en-us/web/javascript/reference/global_objects/dataview/setint32/index.html
@@ -25,7 +25,7 @@
 

Syntax

dataview.setInt32(byteOffset, value [, littleEndian])
+ class="brush: js">dataview.setInt32(byteOffset, value [, littleEndian])

Parameters

@@ -56,7 +56,7 @@

Examples

Using the setInt32 method

-
var buffer = new ArrayBuffer(8);
+
var buffer = new ArrayBuffer(8);
 var dataview = new DataView(buffer);
 dataview.setInt32(1, 3);
 dataview.getInt32(1); // 3
diff --git a/files/en-us/web/javascript/reference/global_objects/dataview/setint8/index.html b/files/en-us/web/javascript/reference/global_objects/dataview/setint8/index.html
index c8e5e1190db66de..48e36284da5e2fe 100644
--- a/files/en-us/web/javascript/reference/global_objects/dataview/setint8/index.html
+++ b/files/en-us/web/javascript/reference/global_objects/dataview/setint8/index.html
@@ -24,7 +24,7 @@
 

Syntax

dataview.setInt8(byteOffset, value)
+ class="brush: js">dataview.setInt8(byteOffset, value)

Parameters

@@ -51,7 +51,7 @@

Examples

Using the setInt8 method

-
var buffer = new ArrayBuffer(8);
+
var buffer = new ArrayBuffer(8);
 var dataview = new DataView(buffer);
 dataview.setInt8(1, 3);
 dataview.getInt8(1); // 3
diff --git a/files/en-us/web/javascript/reference/global_objects/dataview/setuint16/index.html b/files/en-us/web/javascript/reference/global_objects/dataview/setuint16/index.html
index 8f73633ae4dde17..947522ef9ae8537 100644
--- a/files/en-us/web/javascript/reference/global_objects/dataview/setuint16/index.html
+++ b/files/en-us/web/javascript/reference/global_objects/dataview/setuint16/index.html
@@ -25,7 +25,7 @@
 

Syntax

dataview.setUint16(byteOffset, value [, littleEndian])
+ class="brush: js">dataview.setUint16(byteOffset, value [, littleEndian])

Parameters

@@ -56,7 +56,7 @@

Examples

Using the setUint16 method

-
var buffer = new ArrayBuffer(8);
+
var buffer = new ArrayBuffer(8);
 var dataview = new DataView(buffer);
 dataview.setUint16(1, 3);
 dataview.getUint16(1); // 3
diff --git a/files/en-us/web/javascript/reference/global_objects/dataview/setuint32/index.html b/files/en-us/web/javascript/reference/global_objects/dataview/setuint32/index.html
index 9cab544f1483803..6d10cc223c245a6 100644
--- a/files/en-us/web/javascript/reference/global_objects/dataview/setuint32/index.html
+++ b/files/en-us/web/javascript/reference/global_objects/dataview/setuint32/index.html
@@ -25,7 +25,7 @@
 

Syntax

dataview.setUint32(byteOffset, value [, littleEndian])
+ class="brush: js">dataview.setUint32(byteOffset, value [, littleEndian])

Parameters

@@ -56,7 +56,7 @@

Examples

Using the setUint32 method

-
var buffer = new ArrayBuffer(8);
+
var buffer = new ArrayBuffer(8);
 var dataview = new DataView(buffer);
 dataview.setUint32(1, 3);
 dataview.getUint32(1); // 3
diff --git a/files/en-us/web/javascript/reference/global_objects/dataview/setuint8/index.html b/files/en-us/web/javascript/reference/global_objects/dataview/setuint8/index.html
index 0f742a227226f0f..975d9d9ebed69fc 100644
--- a/files/en-us/web/javascript/reference/global_objects/dataview/setuint8/index.html
+++ b/files/en-us/web/javascript/reference/global_objects/dataview/setuint8/index.html
@@ -19,7 +19,7 @@
 

Syntax

dataview.setUint8(byteOffset, value)
+ class="brush: js">dataview.setUint8(byteOffset, value)

Parameters

@@ -46,7 +46,7 @@

Examples

Using the setUint8 method

-
var buffer = new ArrayBuffer(8);
+
var buffer = new ArrayBuffer(8);
 var dataview = new DataView(buffer);
 dataview.setUint8(1, 3);
 dataview.getUint8(1); // 3
diff --git a/files/en-us/web/javascript/reference/global_objects/date/@@toprimitive/index.html b/files/en-us/web/javascript/reference/global_objects/date/@@toprimitive/index.html
index 0dd50703b133146..4dbf85a364f385c 100644
--- a/files/en-us/web/javascript/reference/global_objects/date/@@toprimitive/index.html
+++ b/files/en-us/web/javascript/reference/global_objects/date/@@toprimitive/index.html
@@ -15,7 +15,7 @@
 
 

Syntax

-
Date()[Symbol.toPrimitive](hint);
+
Date()[Symbol.toPrimitive](hint);

Return value

@@ -46,7 +46,7 @@

Examples

Returning date primitives

-
const testDate = new Date(1590757517834);
+
const testDate = new Date(1590757517834);
 // "Date Fri May 29 2020 14:05:17 GMT+0100 (British Summer Time)"
 
 testDate[Symbol.toPrimitive]('string');
diff --git a/files/en-us/web/javascript/reference/global_objects/date/date/index.html b/files/en-us/web/javascript/reference/global_objects/date/date/index.html
index 7278d7cd4bf4f71..265e72e421f7289 100644
--- a/files/en-us/web/javascript/reference/global_objects/date/date/index.html
+++ b/files/en-us/web/javascript/reference/global_objects/date/date/index.html
@@ -24,7 +24,7 @@
 
 

Syntax

-
new Date()
+
new Date()
 new Date(value)
 new Date(dateString)
 new Date(year, monthIndex [, day [, hours [, minutes [, seconds [, milliseconds]]]]])
@@ -143,7 +143,7 @@ 

Several ways to create a Date obje browser differences and inconsistencies.

-
let today = new Date()
+
let today = new Date()
 let birthday = new Date('December 17, 1995 03:24:00')
 let birthday = new Date('1995-12-17T03:24:00')
 let birthday = new Date(1995, 11, 17)            // the month is 0-indexed
diff --git a/files/en-us/web/javascript/reference/global_objects/date/getdate/index.html b/files/en-us/web/javascript/reference/global_objects/date/getdate/index.html
index b7ab4fba5727863..caf02c0f6e12910 100644
--- a/files/en-us/web/javascript/reference/global_objects/date/getdate/index.html
+++ b/files/en-us/web/javascript/reference/global_objects/date/getdate/index.html
@@ -23,7 +23,7 @@
 
 

Syntax

-
dateObj.getDate()
+
dateObj.getDate()

Return value

@@ -37,7 +37,7 @@

Using getDate()

The second statement below assigns the value 25 to the variable day, based on the value of the {{jsxref("Date")}} object Xmas95.

-
var Xmas95 = new Date('December 25, 1995 23:15:30');
+
var Xmas95 = new Date('December 25, 1995 23:15:30');
 var day = Xmas95.getDate();
 
 console.log(day); // 25
diff --git a/files/en-us/web/javascript/reference/global_objects/date/getday/index.html b/files/en-us/web/javascript/reference/global_objects/date/getday/index.html
index d9f323ab9f58656..1aee11c5e064940 100644
--- a/files/en-us/web/javascript/reference/global_objects/date/getday/index.html
+++ b/files/en-us/web/javascript/reference/global_objects/date/getday/index.html
@@ -25,7 +25,7 @@
 
 

Syntax

-
dateObj.getDay()
+
dateObj.getDay()

Return value

@@ -40,7 +40,7 @@

Using getDay()

value of the {{jsxref("Date")}} object Xmas95. December 25, 1995, is a Monday.

-
var Xmas95 = new Date('December 25, 1995 23:15:30');
+
var Xmas95 = new Date('December 25, 1995 23:15:30');
 var weekday = Xmas95.getDay();
 
 console.log(weekday); // 1
@@ -52,7 +52,7 @@ 

Using getDay()

with an options parameter. Using this method, the internationalization is made easier:

-
var options = { weekday: 'long'};
+  
var options = { weekday: 'long'};
 console.log(new Intl.DateTimeFormat('en-US', options).format(Xmas95));
 // Monday
 console.log(new Intl.DateTimeFormat('de-DE', options).format(Xmas95));
diff --git a/files/en-us/web/javascript/reference/global_objects/date/getfullyear/index.html b/files/en-us/web/javascript/reference/global_objects/date/getfullyear/index.html
index 3657541b6bfd4b8..2c6cc5b55e32311 100644
--- a/files/en-us/web/javascript/reference/global_objects/date/getfullyear/index.html
+++ b/files/en-us/web/javascript/reference/global_objects/date/getfullyear/index.html
@@ -26,7 +26,7 @@
 
 

Syntax

-
dateObj.getFullYear()
+
dateObj.getFullYear()

Return value

@@ -46,7 +46,7 @@

Using getFullYear()

The following example assigns the four-digit value of the current year to the variable year.

-
var today = new Date();
+
var today = new Date();
 var year = today.getFullYear();
 
diff --git a/files/en-us/web/javascript/reference/global_objects/date/gethours/index.html b/files/en-us/web/javascript/reference/global_objects/date/gethours/index.html index 8e601c090e928d3..f05eec852079c38 100644 --- a/files/en-us/web/javascript/reference/global_objects/date/gethours/index.html +++ b/files/en-us/web/javascript/reference/global_objects/date/gethours/index.html @@ -17,7 +17,7 @@

Syntax

-
dateObj.getHours()
+
dateObj.getHours()

Return value

@@ -32,7 +32,7 @@

Using getHours()

based on the value of the {{jsxref("Global_Objects/Date", "Date")}} object Xmas95.

-
let Xmas95 = new Date('December 25, 1995 23:15:30');
+
let Xmas95 = new Date('December 25, 1995 23:15:30');
 let hours = Xmas95.getHours();
 
 console.log(hours); // 23
diff --git a/files/en-us/web/javascript/reference/global_objects/date/getmilliseconds/index.html b/files/en-us/web/javascript/reference/global_objects/date/getmilliseconds/index.html
index 38f63400da22dc6..501831187f278ef 100644
--- a/files/en-us/web/javascript/reference/global_objects/date/getmilliseconds/index.html
+++ b/files/en-us/web/javascript/reference/global_objects/date/getmilliseconds/index.html
@@ -23,7 +23,7 @@
 
 

Syntax

-
dateObj.getMilliseconds()
+
dateObj.getMilliseconds()

Return value

@@ -37,7 +37,7 @@

Using getMilliseconds()

The following example assigns the milliseconds portion of the current time to the variable milliseconds:

-
var today = new Date();
+
var today = new Date();
 var milliseconds = today.getMilliseconds();
 
diff --git a/files/en-us/web/javascript/reference/global_objects/date/getminutes/index.html b/files/en-us/web/javascript/reference/global_objects/date/getminutes/index.html index f93a5c26d590cc3..9756b92919ae7ef 100644 --- a/files/en-us/web/javascript/reference/global_objects/date/getminutes/index.html +++ b/files/en-us/web/javascript/reference/global_objects/date/getminutes/index.html @@ -23,7 +23,7 @@

Syntax

-
dateObj.getMinutes()
+
dateObj.getMinutes()

Return value

@@ -38,7 +38,7 @@

Using getMinutes()

based on the value of the {{jsxref("Global_Objects/Date", "Date")}} object Xmas95.

-
var Xmas95 = new Date('December 25, 1995 23:15:30');
+
var Xmas95 = new Date('December 25, 1995 23:15:30');
 var minutes = Xmas95.getMinutes();
 
 console.log(minutes); // 15
diff --git a/files/en-us/web/javascript/reference/global_objects/date/getmonth/index.html b/files/en-us/web/javascript/reference/global_objects/date/getmonth/index.html
index 3e1ce012f5439fd..b4a549b97512eee 100644
--- a/files/en-us/web/javascript/reference/global_objects/date/getmonth/index.html
+++ b/files/en-us/web/javascript/reference/global_objects/date/getmonth/index.html
@@ -24,7 +24,7 @@
 
 

Syntax

-
dateObj.getMonth()
+
dateObj.getMonth()

Return value

@@ -38,7 +38,7 @@

Using getMonth()

The second statement below assigns the value 11 to the variable month, based on the value of the {{jsxref("Date")}} object Xmas95.

-
var Xmas95 = new Date('December 25, 1995 23:15:30');
+
var Xmas95 = new Date('December 25, 1995 23:15:30');
 var month = Xmas95.getMonth();
 
 console.log(month); // 11
@@ -51,7 +51,7 @@ 

Using getMonth()

with an options parameter. Using this method, internationalization is made easier:

-
var options = { month: 'long'};
+  
var options = { month: 'long'};
 console.log(new Intl.DateTimeFormat('en-US', options).format(Xmas95));
 // December
 console.log(new Intl.DateTimeFormat('de-DE', options).format(Xmas95));
diff --git a/files/en-us/web/javascript/reference/global_objects/date/getseconds/index.html b/files/en-us/web/javascript/reference/global_objects/date/getseconds/index.html
index 6ecdf2a6f9ad790..ad82e0bf188a19e 100644
--- a/files/en-us/web/javascript/reference/global_objects/date/getseconds/index.html
+++ b/files/en-us/web/javascript/reference/global_objects/date/getseconds/index.html
@@ -23,7 +23,7 @@
 
 

Syntax

-
dateObj.getSeconds()
+
dateObj.getSeconds()

Return value

@@ -38,7 +38,7 @@

Using getSeconds()

based on the value of the {{jsxref("Global_Objects/Date", "Date")}} object Xmas95.

-
var Xmas95 = new Date('December 25, 1995 23:15:30');
+
var Xmas95 = new Date('December 25, 1995 23:15:30');
 var seconds = Xmas95.getSeconds();
 
 console.log(seconds); // 30
diff --git a/files/en-us/web/javascript/reference/global_objects/date/gettime/index.html b/files/en-us/web/javascript/reference/global_objects/date/gettime/index.html
index c9ecb1d5605534d..db28279ca5715a7 100644
--- a/files/en-us/web/javascript/reference/global_objects/date/gettime/index.html
+++ b/files/en-us/web/javascript/reference/global_objects/date/gettime/index.html
@@ -28,7 +28,7 @@
 
 

Syntax

-
dateObj.getTime()
+
dateObj.getTime()

Return value

@@ -42,7 +42,7 @@

Reduced time precision

Firefox, the privacy.reduceTimerPrecision preference is enabled by default and defaults to 20µs in Firefox 59; in 60 it will be 2ms.

-
// reduced time precision (2ms) in Firefox 60
+
// reduced time precision (2ms) in Firefox 60
 new Date().getTime();
 // 1519211809934
 // 1519211810362
@@ -69,7 +69,7 @@ 

Using getTime() for copyin

Constructing a date object with the identical time value.

-
// Since month is zero based, birthday will be January 10, 1995
+
// Since month is zero based, birthday will be January 10, 1995
 var birthday = new Date(1994, 12, 10);
 var copy = new Date();
 copy.setTime(birthday.getTime());
@@ -82,7 +82,7 @@ 

Measuring execution time

to calculate the executing time of some operations. See also {{jsxref("Date.now()")}} to prevent instantiating unnecessary {{jsxref("Date")}} objects.

-
var end, start;
+
var end, start;
 
 start = new Date();
 for (var i = 0; i < 1000; i++) {
diff --git a/files/en-us/web/javascript/reference/global_objects/date/gettimezoneoffset/index.html b/files/en-us/web/javascript/reference/global_objects/date/gettimezoneoffset/index.html
index 5b20fab56fbc584..d4cd8c5700906c7 100644
--- a/files/en-us/web/javascript/reference/global_objects/date/gettimezoneoffset/index.html
+++ b/files/en-us/web/javascript/reference/global_objects/date/gettimezoneoffset/index.html
@@ -17,7 +17,7 @@
 
 

Syntax

-
dateObj.getTimezoneOffset()
+
dateObj.getTimezoneOffset()

Return value

@@ -62,7 +62,7 @@

Examples

Using getTimezoneOffset()

-
// Get current timezone offset for host device
+
// Get current timezone offset for host device
 let x = new Date();
 let currentTimeZoneOffsetInHours = x.getTimezoneOffset() / 60;
 // 1
diff --git a/files/en-us/web/javascript/reference/global_objects/date/getutcdate/index.html b/files/en-us/web/javascript/reference/global_objects/date/getutcdate/index.html
index 16637e283b77ad0..b0af50988cb8d5b 100644
--- a/files/en-us/web/javascript/reference/global_objects/date/getutcdate/index.html
+++ b/files/en-us/web/javascript/reference/global_objects/date/getutcdate/index.html
@@ -23,7 +23,7 @@
 
 

Syntax

-
dateObj.getUTCDate()
+
dateObj.getUTCDate()

Return value

@@ -37,7 +37,7 @@

Using getUTCDate()

The following example assigns the day of month of the current date to the variable dayOfMonth.

-
var today = new Date();
+
var today = new Date();
 var dayOfMonth = today.getUTCDate();
 
diff --git a/files/en-us/web/javascript/reference/global_objects/date/getutcday/index.html b/files/en-us/web/javascript/reference/global_objects/date/getutcday/index.html index ad2ab5a5b7e7a9e..9706e606d0dea0d 100644 --- a/files/en-us/web/javascript/reference/global_objects/date/getutcday/index.html +++ b/files/en-us/web/javascript/reference/global_objects/date/getutcday/index.html @@ -23,7 +23,7 @@

Syntax

-
dateObj.getUTCDay()
+
dateObj.getUTCDay()

Return value

@@ -37,7 +37,7 @@

Using getUTCDay()

The following example assigns the weekday portion of the current date to the variable weekday.

-
var today = new Date();
+
var today = new Date();
 var weekday = today.getUTCDay();
 
diff --git a/files/en-us/web/javascript/reference/global_objects/date/getutcfullyear/index.html b/files/en-us/web/javascript/reference/global_objects/date/getutcfullyear/index.html index 81a9d2b15f8b9e6..96566e47e9ec694 100644 --- a/files/en-us/web/javascript/reference/global_objects/date/getutcfullyear/index.html +++ b/files/en-us/web/javascript/reference/global_objects/date/getutcfullyear/index.html @@ -23,7 +23,7 @@

Syntax

-
dateObj.getUTCFullYear()
+
dateObj.getUTCFullYear()

Return value

@@ -41,7 +41,7 @@

Using getUTCFullYear()

The following example assigns the four-digit value of the current year to the variable year.

-
var today = new Date();
+
var today = new Date();
 var year = today.getUTCFullYear();
 
diff --git a/files/en-us/web/javascript/reference/global_objects/date/getutchours/index.html b/files/en-us/web/javascript/reference/global_objects/date/getutchours/index.html index 473ba8d64b4393d..0d4603785a09827 100644 --- a/files/en-us/web/javascript/reference/global_objects/date/getutchours/index.html +++ b/files/en-us/web/javascript/reference/global_objects/date/getutchours/index.html @@ -23,7 +23,7 @@

Syntax

-
dateObj.getUTCHours()
+
dateObj.getUTCHours()

Return value

@@ -37,7 +37,7 @@

Using getUTCHours()

The following example assigns the hours portion of the current time to the variable hours.

-
var today = new Date();
+
var today = new Date();
 var hours = today.getUTCHours();
 
diff --git a/files/en-us/web/javascript/reference/global_objects/date/getutcmilliseconds/index.html b/files/en-us/web/javascript/reference/global_objects/date/getutcmilliseconds/index.html index d62dbf62ec0fc6d..97d95ee8d7e3c55 100644 --- a/files/en-us/web/javascript/reference/global_objects/date/getutcmilliseconds/index.html +++ b/files/en-us/web/javascript/reference/global_objects/date/getutcmilliseconds/index.html @@ -23,7 +23,7 @@

Syntax

-
dateObj.getUTCMilliseconds()
+
dateObj.getUTCMilliseconds()

Return value

@@ -41,7 +41,7 @@

Using getUTCMilliseconds()

The following example assigns the milliseconds portion of the current time to the variable milliseconds.

-
var today = new Date();
+
var today = new Date();
 var milliseconds = today.getUTCMilliseconds();
 
diff --git a/files/en-us/web/javascript/reference/global_objects/date/getutcminutes/index.html b/files/en-us/web/javascript/reference/global_objects/date/getutcminutes/index.html index fd96d451407fb80..5036865c28fed1f 100644 --- a/files/en-us/web/javascript/reference/global_objects/date/getutcminutes/index.html +++ b/files/en-us/web/javascript/reference/global_objects/date/getutcminutes/index.html @@ -23,7 +23,7 @@

Syntax

-
dateObj.getUTCMinutes()
+
dateObj.getUTCMinutes()

Return value

@@ -37,7 +37,7 @@

Using getUTCMinutes()

The following example assigns the minutes portion of the current time to the variable minutes.

-
var today = new Date();
+
var today = new Date();
 var minutes = today.getUTCMinutes();
 
diff --git a/files/en-us/web/javascript/reference/global_objects/date/getutcmonth/index.html b/files/en-us/web/javascript/reference/global_objects/date/getutcmonth/index.html index b5bcae30228079d..02d082fdb6026c5 100644 --- a/files/en-us/web/javascript/reference/global_objects/date/getutcmonth/index.html +++ b/files/en-us/web/javascript/reference/global_objects/date/getutcmonth/index.html @@ -24,7 +24,7 @@

Syntax

-
dateObj.getUTCMonth()
+
dateObj.getUTCMonth()

Return value

@@ -38,7 +38,7 @@

Using getUTCMonth()

The following example assigns the month portion of the current date to the variable month.

-
var today = new Date();
+
var today = new Date();
 var month = today.getUTCMonth();
 
diff --git a/files/en-us/web/javascript/reference/global_objects/date/getutcseconds/index.html b/files/en-us/web/javascript/reference/global_objects/date/getutcseconds/index.html index 49e8a3d9225fa94..813efa31eb421ba 100644 --- a/files/en-us/web/javascript/reference/global_objects/date/getutcseconds/index.html +++ b/files/en-us/web/javascript/reference/global_objects/date/getutcseconds/index.html @@ -23,7 +23,7 @@

Syntax

-
dateObj.getUTCSeconds()
+
dateObj.getUTCSeconds()

Return value

@@ -37,7 +37,7 @@

Using getUTCSeconds()

The following example assigns the seconds portion of the current time to the variable seconds.

-
var today = new Date();
+
var today = new Date();
 var seconds = today.getUTCSeconds();
 
diff --git a/files/en-us/web/javascript/reference/global_objects/date/getyear/index.html b/files/en-us/web/javascript/reference/global_objects/date/getyear/index.html index 9214f22020b14f0..782c066f72e38d5 100644 --- a/files/en-us/web/javascript/reference/global_objects/date/getyear/index.html +++ b/files/en-us/web/javascript/reference/global_objects/date/getyear/index.html @@ -18,7 +18,7 @@

Syntax

-
dateObj.getYear()
+
dateObj.getYear()

Return value

@@ -64,7 +64,7 @@

Years between 1900 and 1999

The second statement assigns the value 95 to the variable year.

-
var Xmas = new Date('December 25, 1995 23:15:00');
+
var Xmas = new Date('December 25, 1995 23:15:00');
 var year = Xmas.getYear(); // returns 95
 
@@ -72,7 +72,7 @@

Years above 1999

The second statement assigns the value 100 to the variable year.

-
var Xmas = new Date('December 25, 2000 23:15:00');
+
var Xmas = new Date('December 25, 2000 23:15:00');
 var year = Xmas.getYear(); // returns 100
 
@@ -80,7 +80,7 @@

Years below 1900

The second statement assigns the value -100 to the variable year.

-
var Xmas = new Date('December 25, 1800 23:15:00');
+
var Xmas = new Date('December 25, 1800 23:15:00');
 var year = Xmas.getYear(); // returns -100
 
@@ -90,7 +90,7 @@

Setting and getting a

The third statement assigns the value 95 to the variable year, representing the year 1995.

-
var Xmas = new Date('December 25, 2015 23:15:00');
+
var Xmas = new Date('December 25, 2015 23:15:00');
 Xmas.setYear(95);
 var year = Xmas.getYear(); // returns 95
 
diff --git a/files/en-us/web/javascript/reference/global_objects/date/index.html b/files/en-us/web/javascript/reference/global_objects/date/index.html index db0f86db20f4f0e..164ae81664be5f1 100644 --- a/files/en-us/web/javascript/reference/global_objects/date/index.html +++ b/files/en-us/web/javascript/reference/global_objects/date/index.html @@ -166,7 +166,7 @@

Several ways to create a Date obje

Note: Parsing of date strings with the Date constructor (and Date.parse, they are equivalent) is strongly discouraged due to browser differences and inconsistencies.

-
let today = new Date()
+
let today = new Date()
 let birthday = new Date('December 17, 1995 03:24:00')
 let birthday = new Date('1995-12-17T03:24:00')
 let birthday = new Date(1995, 11, 17)            // the month is 0-indexed
@@ -176,7 +176,7 @@ 

Several ways to create a Date obje

 To get Date, Month and Year or Time

-
let [month, date, year]    = new Date().toLocaleDateString("en-US").split("/")
+
let [month, date, year]    = new Date().toLocaleDateString("en-US").split("/")
 let [hour, minute, second] = new Date().toLocaleTimeString("en-US").split(/:| /)

Two digit years map to 1900 – 1999

@@ -185,7 +185,7 @@

Two digit years map to 1900 – 19

In order to create and get dates between the years 0 and 99 the {{jsxref("Date.prototype.setFullYear()")}} and {{jsxref("Date.prototype.getFullYear()")}} methods should be used.

-
let date = new Date(98, 1)  // Sun Feb 01 1998 00:00:00 GMT+0000 (GMT)
+
let date = new Date(98, 1)  // Sun Feb 01 1998 00:00:00 GMT+0000 (GMT)
 
 // Deprecated method; 98 maps to 1998 here as well
 date.setYear(98)            // Sun Feb 01 1998 00:00:00 GMT+0000 (GMT)
@@ -199,7 +199,7 @@ 

Calculating elapsed time

Due to the differing lengths of days (due to daylight saving changeover), months, and years, expressing elapsed time in units greater than hours, minutes, and seconds requires addressing a number of issues, and should be thoroughly researched before being attempted.

-
// Using Date objects
+
// Using Date objects
 let start = Date.now()
 
 // The event to time goes here:
@@ -208,7 +208,7 @@ 

Calculating elapsed time

let elapsed = end - start // elapsed time in milliseconds
-
// Using built-in methods
+
// Using built-in methods
 let start = new Date()
 
 // The event to time goes here:
@@ -217,7 +217,7 @@ 

Calculating elapsed time

let elapsed = end.getTime() - start.getTime() // elapsed time in milliseconds
-
// To test a function and get back its return
+
// To test a function and get back its return
 function printElapsedTime(fTest) {
   let nStartTime = Date.now(),
       vReturn = fTest(),
@@ -236,7 +236,7 @@ 

Calculating elapsed time

Get the number of seconds since the ECMAScript Epoch

-
let seconds = Math.floor(Date.now() / 1000)
+
let seconds = Math.floor(Date.now() / 1000)
 

In this case, it's important to return only an integer—so a simple division won't do. It's also important to only return actually elapsed seconds. (That's why this code uses {{jsxref("Math.floor()")}}, and not {{jsxref("Math.round()")}}.)

diff --git a/files/en-us/web/javascript/reference/global_objects/date/now/index.html b/files/en-us/web/javascript/reference/global_objects/date/now/index.html index 247817f2a881056..7692afe5d4409bc 100644 --- a/files/en-us/web/javascript/reference/global_objects/date/now/index.html +++ b/files/en-us/web/javascript/reference/global_objects/date/now/index.html @@ -18,7 +18,7 @@

Syntax

-
var timeInMs = Date.now();
+
var timeInMs = Date.now();

Return value

@@ -30,7 +30,7 @@

Polyfill

been updated to support this method can work around the absence of this method using the following shim:

-
if (!Date.now) {
+
if (!Date.now) {
   Date.now = function now() {
     return new Date().getTime();
   };
@@ -46,7 +46,7 @@ 

Reduced time precision

In Firefox, the privacy.reduceTimerPrecision  preference is enabled by default and defaults to 20µs in Firefox 59; in 60 it will be 2ms.

-
// reduced time precision (2ms) in Firefox 60
+
// reduced time precision (2ms) in Firefox 60
 Date.now()
 // 1519211809934
 // 1519211810362
diff --git a/files/en-us/web/javascript/reference/global_objects/date/parse/index.html b/files/en-us/web/javascript/reference/global_objects/date/parse/index.html
index 7ec9ecc697a7702..7e052c285ba8472 100644
--- a/files/en-us/web/javascript/reference/global_objects/date/parse/index.html
+++ b/files/en-us/web/javascript/reference/global_objects/date/parse/index.html
@@ -31,12 +31,12 @@ 

Syntax

Direct call:

-
Date.parse(dateString)
+
Date.parse(dateString)
 

Implicit call:

-
new Date(dateString)
+
new Date(dateString)
 

Parameters

diff --git a/files/en-us/web/javascript/reference/global_objects/date/setdate/index.html b/files/en-us/web/javascript/reference/global_objects/date/setdate/index.html index 23629b180b56c73..a5e89a729a43365 100644 --- a/files/en-us/web/javascript/reference/global_objects/date/setdate/index.html +++ b/files/en-us/web/javascript/reference/global_objects/date/setdate/index.html @@ -23,7 +23,7 @@

Syntax

-
dateObj.setDate(dayValue)
+
dateObj.setDate(dayValue)

Parameters

@@ -53,7 +53,7 @@

Examples

Using setDate()

-
var theBigDay = new Date(1962, 6, 7); // 1962-07-07 (7th of July 1962)
+
var theBigDay = new Date(1962, 6, 7); // 1962-07-07 (7th of July 1962)
 theBigDay.setDate(24);  // 1962-07-24 (24th of July 1962)
 theBigDay.setDate(32);  // 1962-08-01 (1st of August 1962)
 theBigDay.setDate(22);  // 1962-08-22 (22th of August 1962)
diff --git a/files/en-us/web/javascript/reference/global_objects/date/setfullyear/index.html b/files/en-us/web/javascript/reference/global_objects/date/setfullyear/index.html
index 25605ce43fab479..6e2f8aefea0e74b 100644
--- a/files/en-us/web/javascript/reference/global_objects/date/setfullyear/index.html
+++ b/files/en-us/web/javascript/reference/global_objects/date/setfullyear/index.html
@@ -24,7 +24,7 @@
 

Syntax

dateObj.setFullYear(yearValue[, monthValue[, dateValue]])
+ class="brush: js">dateObj.setFullYear(yearValue[, monthValue[, dateValue]])

Parameters

@@ -62,7 +62,7 @@

Examples

Using setFullYear()

-
var theBigDay = new Date();
+
var theBigDay = new Date();
 theBigDay.setFullYear(1997);
 
diff --git a/files/en-us/web/javascript/reference/global_objects/date/sethours/index.html b/files/en-us/web/javascript/reference/global_objects/date/sethours/index.html index 07a2a60b605f1a1..783b33504f79c53 100644 --- a/files/en-us/web/javascript/reference/global_objects/date/sethours/index.html +++ b/files/en-us/web/javascript/reference/global_objects/date/sethours/index.html @@ -25,12 +25,12 @@

Syntax

dateObj.setHours(hoursValue[, minutesValue[, secondsValue[, msValue]]])
+ class="brush: js">dateObj.setHours(hoursValue[, minutesValue[, secondsValue[, msValue]]])

Versions prior to JavaScript 1.3

dateObj.setHours(hoursValue)
+ class="brush: js">dateObj.setHours(hoursValue)

Parameters

@@ -79,7 +79,7 @@

Examples

Using setHours()

-
var theBigDay = new Date();
+
var theBigDay = new Date();
 theBigDay.setHours(7);
 
diff --git a/files/en-us/web/javascript/reference/global_objects/date/setmilliseconds/index.html b/files/en-us/web/javascript/reference/global_objects/date/setmilliseconds/index.html index 9b8619d1a88043b..085b0913010b275 100644 --- a/files/en-us/web/javascript/reference/global_objects/date/setmilliseconds/index.html +++ b/files/en-us/web/javascript/reference/global_objects/date/setmilliseconds/index.html @@ -24,7 +24,7 @@

Syntax

dateObj.setMilliseconds(millisecondsValue)
+ class="brush: js">dateObj.setMilliseconds(millisecondsValue)

Parameters

@@ -48,7 +48,7 @@

Examples

Using setMilliseconds()

-
var theBigDay = new Date();
+
var theBigDay = new Date();
 theBigDay.setMilliseconds(100);
 
diff --git a/files/en-us/web/javascript/reference/global_objects/date/setminutes/index.html b/files/en-us/web/javascript/reference/global_objects/date/setminutes/index.html index ee16b38e43a1ff7..ad08738776fc904 100644 --- a/files/en-us/web/javascript/reference/global_objects/date/setminutes/index.html +++ b/files/en-us/web/javascript/reference/global_objects/date/setminutes/index.html @@ -24,12 +24,12 @@

Syntax

dateObj.setMinutes(minutesValue[, secondsValue[, msValue]])
+ class="brush: js">dateObj.setMinutes(minutesValue[, secondsValue[, msValue]])

Versions prior to JavaScript 1.3

dateObj.setMinutes(minutesValue)
+ class="brush: js">dateObj.setMinutes(minutesValue)

Parameters

@@ -69,7 +69,7 @@

Examples

Using setMinutes()

-
var theBigDay = new Date();
+
var theBigDay = new Date();
 theBigDay.setMinutes(45);
 
diff --git a/files/en-us/web/javascript/reference/global_objects/date/setmonth/index.html b/files/en-us/web/javascript/reference/global_objects/date/setmonth/index.html index 6286a7c50d02922..5286ea23aefe5a6 100644 --- a/files/en-us/web/javascript/reference/global_objects/date/setmonth/index.html +++ b/files/en-us/web/javascript/reference/global_objects/date/setmonth/index.html @@ -18,12 +18,12 @@

Syntax

dateObj.setMonth(monthValue[, dayValue])
+ class="brush: js">dateObj.setMonth(monthValue[, dayValue])

Versions prior to JavaScript 1.3

dateObj.setMonth(monthValue)
+ class="brush: js">dateObj.setMonth(monthValue)

Parameters

@@ -62,7 +62,7 @@

Examples

Using setMonth()

-
var theBigDay = new Date();
+
var theBigDay = new Date();
 theBigDay.setMonth(6);
 
 //Watch out for end of month transitions
diff --git a/files/en-us/web/javascript/reference/global_objects/date/setseconds/index.html b/files/en-us/web/javascript/reference/global_objects/date/setseconds/index.html
index c4c0a8b46fea0fa..dd6de1109f3e4b7 100644
--- a/files/en-us/web/javascript/reference/global_objects/date/setseconds/index.html
+++ b/files/en-us/web/javascript/reference/global_objects/date/setseconds/index.html
@@ -24,12 +24,12 @@
 

Syntax

dateObj.setSeconds(secondsValue[, msValue])
+ class="brush: js">dateObj.setSeconds(secondsValue[, msValue])

Versions prior to JavaScript 1.3

dateObj.setSeconds(secondsValue)
+ class="brush: js">dateObj.setSeconds(secondsValue)

Parameters

@@ -61,7 +61,7 @@

Examples

Using setSeconds()

-
var theBigDay = new Date();
+
var theBigDay = new Date();
 theBigDay.setSeconds(30);
 
diff --git a/files/en-us/web/javascript/reference/global_objects/date/settime/index.html b/files/en-us/web/javascript/reference/global_objects/date/settime/index.html index e83fb0f3ae427b9..865c77391507422 100644 --- a/files/en-us/web/javascript/reference/global_objects/date/settime/index.html +++ b/files/en-us/web/javascript/reference/global_objects/date/settime/index.html @@ -24,7 +24,7 @@

Syntax

-
dateObj.setTime(timeValue)
+
dateObj.setTime(timeValue)

Parameters

@@ -48,7 +48,7 @@

Examples

Using setTime()

-
var theBigDay = new Date('July 1, 1999');
+
var theBigDay = new Date('July 1, 1999');
 var sameAsBigDay = new Date();
 sameAsBigDay.setTime(theBigDay.getTime());
 
diff --git a/files/en-us/web/javascript/reference/global_objects/date/setutcdate/index.html b/files/en-us/web/javascript/reference/global_objects/date/setutcdate/index.html index ee8228d67eade12..4ef70b348c3008f 100644 --- a/files/en-us/web/javascript/reference/global_objects/date/setutcdate/index.html +++ b/files/en-us/web/javascript/reference/global_objects/date/setutcdate/index.html @@ -24,7 +24,7 @@

Syntax

dateObj.setUTCDate(dayValue)
+ class="brush: js">dateObj.setUTCDate(dayValue)

Parameters

@@ -50,7 +50,7 @@

Examples

Using setUTCDate()

-
var theBigDay = new Date();
+
var theBigDay = new Date();
 theBigDay.setUTCDate(20);
 
diff --git a/files/en-us/web/javascript/reference/global_objects/date/setutcfullyear/index.html b/files/en-us/web/javascript/reference/global_objects/date/setutcfullyear/index.html index 6113029cd9c0597..f84d5bab3ed9f10 100644 --- a/files/en-us/web/javascript/reference/global_objects/date/setutcfullyear/index.html +++ b/files/en-us/web/javascript/reference/global_objects/date/setutcfullyear/index.html @@ -24,7 +24,7 @@

Syntax

dateObj.setUTCFullYear(yearValue[, monthValue[, dayValue]])
+ class="brush: js">dateObj.setUTCFullYear(yearValue[, monthValue[, dayValue]])

Parameters

@@ -62,7 +62,7 @@

Examples

Using setUTCFullYear()

-
var theBigDay = new Date();
+
var theBigDay = new Date();
 theBigDay.setUTCFullYear(1997);
 
diff --git a/files/en-us/web/javascript/reference/global_objects/date/setutchours/index.html b/files/en-us/web/javascript/reference/global_objects/date/setutchours/index.html index fcb3eeef8ec5ff4..ce235fab63c8401 100644 --- a/files/en-us/web/javascript/reference/global_objects/date/setutchours/index.html +++ b/files/en-us/web/javascript/reference/global_objects/date/setutchours/index.html @@ -26,7 +26,7 @@

Syntax

dateObj.setUTCHours(hoursValue[, minutesValue[, secondsValue[, msValue]]])
+ class="brush: js">dateObj.setUTCHours(hoursValue[, minutesValue[, secondsValue[, msValue]]])

Parameters

@@ -69,7 +69,7 @@

Examples

Using setUTCHours()

-
var theBigDay = new Date();
+
var theBigDay = new Date();
 theBigDay.setUTCHours(8);
 
diff --git a/files/en-us/web/javascript/reference/global_objects/date/setutcmilliseconds/index.html b/files/en-us/web/javascript/reference/global_objects/date/setutcmilliseconds/index.html index f91f97546d8d9c4..0b08a90c812265d 100644 --- a/files/en-us/web/javascript/reference/global_objects/date/setutcmilliseconds/index.html +++ b/files/en-us/web/javascript/reference/global_objects/date/setutcmilliseconds/index.html @@ -24,7 +24,7 @@

Syntax

dateObj.setUTCMilliseconds(millisecondsValue)
+ class="brush: js">dateObj.setUTCMilliseconds(millisecondsValue)

Parameters

@@ -50,7 +50,7 @@

Examples

Using setUTCMilliseconds()

-
var theBigDay = new Date();
+
var theBigDay = new Date();
 theBigDay.setUTCMilliseconds(500);
 
diff --git a/files/en-us/web/javascript/reference/global_objects/date/setutcminutes/index.html b/files/en-us/web/javascript/reference/global_objects/date/setutcminutes/index.html index d6210f6d20cf6bc..27edb8860ad2faf 100644 --- a/files/en-us/web/javascript/reference/global_objects/date/setutcminutes/index.html +++ b/files/en-us/web/javascript/reference/global_objects/date/setutcminutes/index.html @@ -24,7 +24,7 @@

Syntax

dateObj.setUTCMinutes(minutesValue[, secondsValue[, msValue]])
+ class="brush: js">dateObj.setUTCMinutes(minutesValue[, secondsValue[, msValue]])

Parameters

@@ -64,7 +64,7 @@

Examples

Using setUTCMinutes()

-
var theBigDay = new Date();
+
var theBigDay = new Date();
 theBigDay.setUTCMinutes(43);
 
diff --git a/files/en-us/web/javascript/reference/global_objects/date/setutcmonth/index.html b/files/en-us/web/javascript/reference/global_objects/date/setutcmonth/index.html index 6cd34e0fa18ec75..0ac8a7c0b5377b9 100644 --- a/files/en-us/web/javascript/reference/global_objects/date/setutcmonth/index.html +++ b/files/en-us/web/javascript/reference/global_objects/date/setutcmonth/index.html @@ -24,7 +24,7 @@

Syntax

dateObj.setUTCMonth(monthValue[, dayValue])
+ class="brush: js">dateObj.setUTCMonth(monthValue[, dayValue])

Parameters

@@ -54,7 +54,7 @@

Examples

Using setUTCMonth()

-
var theBigDay = new Date();
+
var theBigDay = new Date();
 theBigDay.setUTCMonth(11);
 
diff --git a/files/en-us/web/javascript/reference/global_objects/date/setutcseconds/index.html b/files/en-us/web/javascript/reference/global_objects/date/setutcseconds/index.html index a89a6e6ba7f2895..c8a454ffca204fd 100644 --- a/files/en-us/web/javascript/reference/global_objects/date/setutcseconds/index.html +++ b/files/en-us/web/javascript/reference/global_objects/date/setutcseconds/index.html @@ -24,7 +24,7 @@

Syntax

dateObj.setUTCSeconds(secondsValue[, msValue])
+ class="brush: js">dateObj.setUTCSeconds(secondsValue[, msValue])

Parameters

@@ -56,7 +56,7 @@

Examples

Using setUTCSeconds()

-
var theBigDay = new Date();
+
var theBigDay = new Date();
 theBigDay.setUTCSeconds(20);
 
diff --git a/files/en-us/web/javascript/reference/global_objects/date/setyear/index.html b/files/en-us/web/javascript/reference/global_objects/date/setyear/index.html index 853ecd22b04ad99..f2b5c4e366c55f5 100644 --- a/files/en-us/web/javascript/reference/global_objects/date/setyear/index.html +++ b/files/en-us/web/javascript/reference/global_objects/date/setyear/index.html @@ -18,7 +18,7 @@

Syntax

-
dateObj.setYear(yearValue)
+
dateObj.setYear(yearValue)

Parameters

@@ -44,7 +44,7 @@

Using setYear()

The first two lines set the year to 1996. The third sets the year to 2000.

-
var theBigDay = new Date();
+
var theBigDay = new Date();
 
 theBigDay.setYear(96);
 theBigDay.setYear(1996);
diff --git a/files/en-us/web/javascript/reference/global_objects/date/todatestring/index.html b/files/en-us/web/javascript/reference/global_objects/date/todatestring/index.html
index a6bc56162b6de51..581c06efde50f44 100644
--- a/files/en-us/web/javascript/reference/global_objects/date/todatestring/index.html
+++ b/files/en-us/web/javascript/reference/global_objects/date/todatestring/index.html
@@ -26,7 +26,7 @@
 
 

Syntax

-
dateObj.toDateString()
+
dateObj.toDateString()

Return value

@@ -55,7 +55,7 @@

Examples

A basic usage of toDateString()

-
var d = new Date(1993, 5, 28, 14, 39, 7);
+
var d = new Date(1993, 5, 28, 14, 39, 7);
 
 console.log(d.toString());     // logs Mon Jun 28 1993 14:39:07 GMT-0600 (PDT)
 console.log(d.toDateString()); // logs Mon Jun 28 1993
diff --git a/files/en-us/web/javascript/reference/global_objects/date/togmtstring/index.html b/files/en-us/web/javascript/reference/global_objects/date/togmtstring/index.html
index e69a62e2b65733d..b3e4ca8adf78a6d 100644
--- a/files/en-us/web/javascript/reference/global_objects/date/togmtstring/index.html
+++ b/files/en-us/web/javascript/reference/global_objects/date/togmtstring/index.html
@@ -24,7 +24,7 @@
 
 

Syntax

-
dateObj.toGMTString()
+
dateObj.toGMTString()

Return value

@@ -39,7 +39,7 @@

Simple example

using the operating system's time-zone offset and returns a string value that is similar to the following form. The exact format depends on the platform.

-
var today = new Date();
+
var today = new Date();
 var str = today.toGMTString();  // deprecated! use toUTCString()
 
 console.log(str);               // Mon, 18 Dec 1995 17:28:35 GMT
diff --git a/files/en-us/web/javascript/reference/global_objects/date/toisostring/index.html b/files/en-us/web/javascript/reference/global_objects/date/toisostring/index.html
index 270468764534984..ae2648353df0f8d 100644
--- a/files/en-us/web/javascript/reference/global_objects/date/toisostring/index.html
+++ b/files/en-us/web/javascript/reference/global_objects/date/toisostring/index.html
@@ -31,7 +31,7 @@
 
 

Syntax

-
dateObj.toISOString()
+
dateObj.toISOString()

Return value

@@ -45,7 +45,7 @@

Polyfill

updated to support this method can work around the absence of this method using the following shim:

-
if (!Date.prototype.toISOString) {
+
if (!Date.prototype.toISOString) {
   (function() {
 
     function pad(number) {
@@ -74,7 +74,7 @@ 

Examples

Using toISOString()

-
let today = new Date('05 October 2011 14:48 UTC')
+
let today = new Date('05 October 2011 14:48 UTC')
 
 console.log(today.toISOString())  // Returns 2011-10-05T14:48:00.000Z
 
diff --git a/files/en-us/web/javascript/reference/global_objects/date/tojson/index.html b/files/en-us/web/javascript/reference/global_objects/date/tojson/index.html index d0b3c343ca5c47d..3cf725c37301b89 100644 --- a/files/en-us/web/javascript/reference/global_objects/date/tojson/index.html +++ b/files/en-us/web/javascript/reference/global_objects/date/tojson/index.html @@ -23,7 +23,7 @@

Syntax

-
dateObj.toJSON()
+
dateObj.toJSON()

Return value

@@ -41,7 +41,7 @@

Examples

Using toJSON()

-
var jsonDate = (new Date()).toJSON();
+
var jsonDate = (new Date()).toJSON();
 var backToDate = new Date(jsonDate);
 
 console.log(jsonDate); //2015-10-26T07:46:36.611Z
diff --git a/files/en-us/web/javascript/reference/global_objects/date/tolocaledatestring/index.html b/files/en-us/web/javascript/reference/global_objects/date/tolocaledatestring/index.html
index 3d174ee50526599..5e4da173b96c1de 100644
--- a/files/en-us/web/javascript/reference/global_objects/date/tolocaledatestring/index.html
+++ b/files/en-us/web/javascript/reference/global_objects/date/tolocaledatestring/index.html
@@ -31,7 +31,7 @@
 

Syntax

dateObj.toLocaleDateString([locales[, options]])
+ class="brush: js">dateObj.toLocaleDateString([locales[, options]])

Parameters

@@ -68,7 +68,7 @@

Using toLocaleDateString()

In basic use without specifying a locale, a formatted string in the default locale and with default options is returned.

-
var date = new Date(Date.UTC(2012, 11, 12, 3, 0, 0));
+
var date = new Date(Date.UTC(2012, 11, 12, 3, 0, 0));
 
 // toLocaleDateString() without arguments depends on the implementation,
 // the default locale, and the default time zone
@@ -84,7 +84,7 @@ 

Checking for sup requirement that illegal language tags are rejected with a {{jsxref("RangeError")}} exception:

-
function toLocaleDateStringSupportsLocales() {
+
function toLocaleDateStringSupportsLocales() {
   try {
     new Date().toLocaleDateString('i');
   } catch (e) {
@@ -101,7 +101,7 @@ 

Using locales

specify that language (and possibly some fallback languages) using the locales argument:

-
var date = new Date(Date.UTC(2012, 11, 20, 3, 0, 0));
+
var date = new Date(Date.UTC(2012, 11, 20, 3, 0, 0));
 
 // formats below assume the local time zone of the locale;
 // America/Los_Angeles for the US
@@ -142,7 +142,7 @@ 

Using options

The results provided by toLocaleDateString() can be customized using the options argument:

-
var date = new Date(Date.UTC(2012, 11, 20, 3, 0, 0));
+
var date = new Date(Date.UTC(2012, 11, 20, 3, 0, 0));
 
 // request a weekday along with a long date
 var options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' };
diff --git a/files/en-us/web/javascript/reference/global_objects/date/tolocalestring/index.html b/files/en-us/web/javascript/reference/global_objects/date/tolocalestring/index.html
index 170f214a3bee6c2..e600484c85ae917 100644
--- a/files/en-us/web/javascript/reference/global_objects/date/tolocalestring/index.html
+++ b/files/en-us/web/javascript/reference/global_objects/date/tolocalestring/index.html
@@ -27,7 +27,7 @@
 

Syntax

dateObj.toLocaleString([locales[, options]])
+ class="brush: js">dateObj.toLocaleString([locales[, options]])

Parameters

@@ -57,7 +57,7 @@

Using toLocaleString()

In basic use without specifying a locale, a formatted string in the default locale and with default options is returned.

-
let date = new Date(Date.UTC(2012, 11, 12, 3, 0, 0));
+
let date = new Date(Date.UTC(2012, 11, 12, 3, 0, 0));
 
 // toLocaleString() without arguments depends on the
 // implementation, the default locale, and the default time zone
@@ -73,7 +73,7 @@ 

Checking for sup already, you can use the requirement that illegal language tags are rejected with a {{jsxref("RangeError")}} exception:

-
function toLocaleStringSupportsLocales() {
+
function toLocaleStringSupportsLocales() {
   try {
     new Date().toLocaleString('i');
   } catch (e) {
@@ -90,7 +90,7 @@ 

Using locales

sure to specify that language (and possibly some fallback languages) using the locales argument:

-
let date = new Date(Date.UTC(2012, 11, 20, 3, 0, 0));
+
let date = new Date(Date.UTC(2012, 11, 20, 3, 0, 0));
 
 // formats below assume the local time zone of the locale;
 // America/Los_Angeles for the US
@@ -127,7 +127,7 @@ 

Using options

The results provided by toLocaleString() can be customized using the options argument:

-
let date = new Date(Date.UTC(2012, 11, 20, 3, 0, 0));
+
let date = new Date(Date.UTC(2012, 11, 20, 3, 0, 0));
 
 // request a weekday along with a long date
 let options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' };
@@ -160,7 +160,7 @@ 

Avoid comparing

For this reason, you cannot expect to be able to compare the results of toLocaleString() to a static value:

-
"1/1/2019, 01:00:00" === new Date("2019-01-01T01:00:00Z").toLocaleString("en-US");
+
"1/1/2019, 01:00:00" === new Date("2019-01-01T01:00:00Z").toLocaleString("en-US");
 // true in Firefox and others
 // false in IE and Edge
diff --git a/files/en-us/web/javascript/reference/global_objects/date/tolocaletimestring/index.html b/files/en-us/web/javascript/reference/global_objects/date/tolocaletimestring/index.html index 8f88ef870a2fc7b..6eb857d6e824a4c 100644 --- a/files/en-us/web/javascript/reference/global_objects/date/tolocaletimestring/index.html +++ b/files/en-us/web/javascript/reference/global_objects/date/tolocaletimestring/index.html @@ -30,7 +30,7 @@

Syntax

dateObj.toLocaleTimeString([locales[, options]])
+ class="brush: js">dateObj.toLocaleTimeString([locales[, options]])

Parameters

@@ -67,7 +67,7 @@

Using toLocaleTimeString()

In basic use without specifying a locale, a formatted string in the default locale and with default options is returned.

-
var date = new Date(Date.UTC(2012, 11, 12, 3, 0, 0));
+
var date = new Date(Date.UTC(2012, 11, 12, 3, 0, 0));
 
 // toLocaleTimeString() without arguments depends on the implementation,
 // the default locale, and the default time zone
@@ -83,7 +83,7 @@ 

Checking for sup requirement that illegal language tags are rejected with a {{jsxref("RangeError")}} exception:

-
function toLocaleTimeStringSupportsLocales() {
+
function toLocaleTimeStringSupportsLocales() {
   try {
     new Date().toLocaleTimeString('i');
   } catch (e) {
@@ -100,7 +100,7 @@ 

Using locales

specify that language (and possibly some fallback languages) using the locales argument:

-
var date = new Date(Date.UTC(2012, 11, 20, 3, 0, 0));
+
var date = new Date(Date.UTC(2012, 11, 20, 3, 0, 0));
 
 // formats below assume the local time zone of the locale;
 // America/Los_Angeles for the US
@@ -132,7 +132,7 @@ 

Using options

The results provided by toLocaleTimeString() can be customized using the options argument:

-
var date = new Date(Date.UTC(2012, 11, 20, 3, 0, 0));
+
var date = new Date(Date.UTC(2012, 11, 20, 3, 0, 0));
 
 // an application may want to use UTC and make that visible
 var options = { timeZone: 'UTC', timeZoneName: 'short' };
diff --git a/files/en-us/web/javascript/reference/global_objects/date/tosource/index.html b/files/en-us/web/javascript/reference/global_objects/date/tosource/index.html
index 520b28b7f753fcb..f254c2b25ab9848 100644
--- a/files/en-us/web/javascript/reference/global_objects/date/tosource/index.html
+++ b/files/en-us/web/javascript/reference/global_objects/date/tosource/index.html
@@ -15,7 +15,7 @@
 
 

Syntax

-
dateObj.toSource()
+
dateObj.toSource()
 Date.toSource()

Return value

diff --git a/files/en-us/web/javascript/reference/global_objects/date/tostring/index.html b/files/en-us/web/javascript/reference/global_objects/date/tostring/index.html index 5d068f0b8696f62..59fd5c0d64bb9e6 100644 --- a/files/en-us/web/javascript/reference/global_objects/date/tostring/index.html +++ b/files/en-us/web/javascript/reference/global_objects/date/tostring/index.html @@ -17,7 +17,7 @@

Syntax

-
dateObj.toString()
+
dateObj.toString()

Return value

@@ -90,7 +90,7 @@

Using toString()

The following assigns the toString() value of a {{jsxref("Date")}} object to myVar:

-
var x = new Date();
+
var x = new Date();
 var myVar = x.toString(); // assigns a string value to myVar in the same format as:
                           // Mon Sep 08 1998 14:36:22 GMT-0700 (PDT)
 
diff --git a/files/en-us/web/javascript/reference/global_objects/date/totimestring/index.html b/files/en-us/web/javascript/reference/global_objects/date/totimestring/index.html index 9d3d1d8b9df1fd9..efa873d9033c7bd 100644 --- a/files/en-us/web/javascript/reference/global_objects/date/totimestring/index.html +++ b/files/en-us/web/javascript/reference/global_objects/date/totimestring/index.html @@ -23,7 +23,7 @@

Syntax

-
dateObj.toTimeString()
+
dateObj.toTimeString()

Return value

@@ -51,7 +51,7 @@

Examples

A basic usage of toTimeString()

-
var d = new Date(1993, 6, 28, 14, 39, 7);
+
var d = new Date(1993, 6, 28, 14, 39, 7);
 
 console.log(d.toString());     // Wed Jul 28 1993 14:39:07 GMT-0600 (PDT)
 console.log(d.toTimeString()); // 14:39:07 GMT-0600 (PDT)
diff --git a/files/en-us/web/javascript/reference/global_objects/date/toutcstring/index.html b/files/en-us/web/javascript/reference/global_objects/date/toutcstring/index.html
index 624c6385beef3b7..56f51d5c18bf479 100644
--- a/files/en-us/web/javascript/reference/global_objects/date/toutcstring/index.html
+++ b/files/en-us/web/javascript/reference/global_objects/date/toutcstring/index.html
@@ -29,7 +29,7 @@
 
 

Syntax

-
dateObj.toUTCString()
+
dateObj.toUTCString()

Return value

@@ -88,7 +88,7 @@

Examples

Using toUTCString()

-
let today = new Date('Wed, 14 Jun 2017 00:00:00 PDT');
+
let today = new Date('Wed, 14 Jun 2017 00:00:00 PDT');
 let UTCstring = today.toUTCString(); // Wed, 14 Jun 2017 07:00:00 GMT
 
diff --git a/files/en-us/web/javascript/reference/global_objects/date/utc/index.html b/files/en-us/web/javascript/reference/global_objects/date/utc/index.html index f94edce543ed466..e50a6a06fcba09c 100644 --- a/files/en-us/web/javascript/reference/global_objects/date/utc/index.html +++ b/files/en-us/web/javascript/reference/global_objects/date/utc/index.html @@ -26,13 +26,13 @@

Syntax

Since ECMAScript 2017:

Date.UTC(year[, month[, day[, hour[, minute[, second[, millisecond]]]]]])
+ class="brush: js">Date.UTC(year[, month[, day[, hour[, minute[, second[, millisecond]]]]]])

ECMAScript 2016 and earlier: (month used to be required)

Date.UTC(year, month[, day[, hour[, minute[, second[, millisecond]]]]])
+ class="brush: js">Date.UTC(year, month[, day[, hour[, minute[, second[, millisecond]]]]])

Parameters

@@ -100,7 +100,7 @@

Using Date.UTC()

The following statement creates a {{jsxref("Date")}} object with the arguments treated as UTC instead of local:

-
let utcDate = new Date(Date.UTC(2018, 11, 1, 0, 0, 0));
+
let utcDate = new Date(Date.UTC(2018, 11, 1, 0, 0, 0));
 

Specifications

@@ -133,7 +133,7 @@

Date.UTC() with fewer than two a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1050755">bug 1050755, ecma-262 #642).

-
Date.UTC();
+
Date.UTC();
 Date.UTC(1);
 
 // Safari: NaN
diff --git a/files/en-us/web/javascript/reference/global_objects/date/valueof/index.html b/files/en-us/web/javascript/reference/global_objects/date/valueof/index.html
index 35abbb29d198fc0..ca9d45a10c82765 100644
--- a/files/en-us/web/javascript/reference/global_objects/date/valueof/index.html
+++ b/files/en-us/web/javascript/reference/global_objects/date/valueof/index.html
@@ -17,7 +17,7 @@
 
 

Syntax

-
dateObj.valueOf()
+
dateObj.valueOf()

Return value

@@ -38,7 +38,7 @@

Examples

Using valueOf()

-
var x = new Date(56, 6, 17);
+
var x = new Date(56, 6, 17);
 var myVar = x.valueOf();      // assigns -424713600000 to myVar
 
diff --git a/files/en-us/web/javascript/reference/global_objects/decodeuri/index.html b/files/en-us/web/javascript/reference/global_objects/decodeuri/index.html index a45cc78df9d2040..e72595ec812981b 100644 --- a/files/en-us/web/javascript/reference/global_objects/decodeuri/index.html +++ b/files/en-us/web/javascript/reference/global_objects/decodeuri/index.html @@ -22,7 +22,7 @@

Syntax

-
decodeURI(encodedURI)
+
decodeURI(encodedURI)

Parameters

@@ -52,13 +52,13 @@

Examples

Decoding a Cyrillic URL

-
decodeURI('https://developer.mozilla.org/ru/docs/JavaScript_%D1%88%D0%B5%D0%BB%D0%BB%D1%8B');
+
decodeURI('https://developer.mozilla.org/ru/docs/JavaScript_%D1%88%D0%B5%D0%BB%D0%BB%D1%8B');
 // "https://developer.mozilla.org/ru/docs/JavaScript_шеллы"
 

Catching errors

-
try {
+
try {
   var a = decodeURI('%E0%A4%A');
 } catch(e) {
   console.error(e);
diff --git a/files/en-us/web/javascript/reference/global_objects/decodeuricomponent/index.html b/files/en-us/web/javascript/reference/global_objects/decodeuricomponent/index.html
index 304ec7643f95408..61c1ef2a0815ff5 100644
--- a/files/en-us/web/javascript/reference/global_objects/decodeuricomponent/index.html
+++ b/files/en-us/web/javascript/reference/global_objects/decodeuricomponent/index.html
@@ -16,7 +16,7 @@
 
 

Syntax

-
decodeURIComponent(encodedURI)
+
decodeURIComponent(encodedURI)

Parameters

diff --git a/files/en-us/web/javascript/reference/global_objects/encodeuri/index.html b/files/en-us/web/javascript/reference/global_objects/encodeuri/index.html index 810af1bb634fad7..f00f8c2c1bf0d4c 100644 --- a/files/en-us/web/javascript/reference/global_objects/encodeuri/index.html +++ b/files/en-us/web/javascript/reference/global_objects/encodeuri/index.html @@ -27,7 +27,7 @@

Syntax

-
encodeURI(URI)
+
encodeURI(URI)

Parameters

@@ -48,7 +48,7 @@

Description

special meaning:

http://username:password@www.example.com:80/path/to/file.php?foo=316&bar=this+has+spaces#anchor
+ class="brush: plain">http://username:password@www.example.com:80/path/to/file.php?foo=316&bar=this+has+spaces#anchor

Hence encodeURI() does not encode characters that are necessary to formulate a complete URI. Also, encodeURI() does @@ -58,7 +58,7 @@

Description

encodeURI() escapes all characters except:

-
Not Escaped:
+
Not Escaped:
 
     A-Z a-z 0-9 ; , / ? : @ & = + $ - _ . ! ~ * ' ( ) #
 
@@ -71,7 +71,7 @@ 

encodeURI vs encodeURIComponent

encodeURI() differs from {{jsxref("encodeURIComponent", "encodeURIComponent()")}} as follows:

-
var set1 = ";,/?:@&=+$#"; // Reserved Characters
+
var set1 = ";,/?:@&=+$#"; // Reserved Characters
 var set2 = "-_.!~*'()";   // Unreserved Marks
 var set3 = "ABC abc 123"; // Alphanumeric Characters + Space
 
@@ -96,7 +96,7 @@ 

Encoding a lone high surrogate th

An {{jsxref("URIError")}} will be thrown if one attempts to encode a surrogate which is not part of a high-low pair, e.g.,

-
// high-low pair ok
+
// high-low pair ok
 console.log(encodeURI('\uD800\uDFFF'));
 
 // lone high surrogate throws "URIError: malformed URI sequence"
@@ -112,7 +112,7 @@ 

Encoding for IPv6

brackets reserved (for {{glossary("IPv6")}}) and thus not encoded when forming something which could be part of a URL (such as a host), the following code snippet may help:

-
function fixedEncodeURI(str) {
+
function fixedEncodeURI(str) {
     return encodeURI(str).replace(/%5B/g, '[').replace(/%5D/g, ']');
 }
diff --git a/files/en-us/web/javascript/reference/global_objects/encodeuricomponent/index.html b/files/en-us/web/javascript/reference/global_objects/encodeuricomponent/index.html index 7c9c0ed7b340d01..06ae744664cd1ac 100644 --- a/files/en-us/web/javascript/reference/global_objects/encodeuricomponent/index.html +++ b/files/en-us/web/javascript/reference/global_objects/encodeuricomponent/index.html @@ -26,7 +26,7 @@

Syntax

-
encodeURIComponent(str);
+
encodeURIComponent(str);

Parameters

@@ -43,7 +43,7 @@

Description

encodeURIComponent() escapes all characters except:

-
Not Escaped:
+
Not Escaped:
 
     A-Z a-z 0-9 - _ . ! ~ * ' ( )
 
@@ -52,7 +52,7 @@ 

Description

encodeURIComponent() differs from encodeURI as follows:

-
var set1 = ";,/?:@&=+$";  // Reserved Characters
+
var set1 = ";,/?:@&=+$";  // Reserved Characters
 var set2 = "-_.!~*'()";   // Unescaped Characters
 var set3 = "#";           // Number Sign
 var set4 = "ABC abc 123"; // Alphanumeric Characters + Space
@@ -72,7 +72,7 @@ 

Description

Note that a {{jsxref("URIError")}} will be thrown if one attempts to encode a surrogate which is not part of a high-low pair, e.g.,

-
// high-low pair ok
+
// high-low pair ok
 console.log(encodeURIComponent('\uD800\uDFFF'));
 
 // lone high surrogate throws "URIError: malformed URI sequence"
@@ -98,7 +98,7 @@ 

Description

and *), even though these characters have no formalized URI delimiting uses, the following can be safely used:

-
function fixedEncodeURIComponent(str) {
+
function fixedEncodeURIComponent(str) {
   return encodeURIComponent(str).replace(/[!'()*]/g, function(c) {
     return '%' + c.charCodeAt(0).toString(16);
   });
@@ -114,7 +114,7 @@