Tagħbija

Fittex

https://mdn.io

JavaScript | MDN
JavaScript (JS) is a lightweight interpreted (or just-in-time compiled) programming language with first-class functions. While it is most well-known as the scripting language for Web pages, many non-browser environments also use it, such as Node.js, Apache CouchDB and Adobe Acrobat. JavaScript is a prototype-based, multi-paradigm, single-threaded, dynamic language, supporting object-oriented, imperative, and declarative (e.g. functional programming) styles.
JavaScript | MDNSkip to main contentSkip to searchSkip to select languageMDN Web DocsOpen main menuReferencesReferencesOverview / Web TechnologyWeb technology reference for developersHTMLStructure of content on the webCSSCode used to describe document styleJavaScriptGeneral-purpose scripting languageHTTPProtocol for transmitting web resourcesWeb APIsInterfaces for building web applicationsWeb ExtensionsDeveloping extensions for web browsersWeb TechnologyWeb technology reference for developersGuidesGuidesOverview / MDN Learning AreaLearn web developmentMDN Learning AreaLearn web developmentHTMLLearn to structure web content with HTMLCSSLearn to style content using CSSJavaScriptLearn to run scripts in the browserAccessibilityLearn to make the web accessible to allPlusPlusOverviewA customized MDN experienceAI HelpGet real-time assistance and supportUpdatesAll browser compatibility updates at a glanceDocumentationLearn how to use MDN PlusFAQFrequently asked questions about MDN PlusCurriculumBlogToolsPlaygroundWrite, test and share your codeHTTP ObservatoryScan a website for freeAI HelpGet real-time assistance and supportSearch MDNClear search inputSearchThemeLog inSign up for freeReferencesJavaScriptArticle ActionsEnglish (US)Remember languageEspañolFrançais日本語한국어Português (do Brasil)Русский中文 (简体)正體中文 (繁體)Filter sidebarClear filter inputIn this articleTutorialsReference JavaScript Tutorials Complete beginners JavaScript basics JavaScript first steps JavaScript building blocks Introducing JavaScript objects JavaScript Guide Introduction Grammar and types Control flow and error handling Loops and iteration Functions Expressions and operators Numbers and dates Text formatting Regular expressions Indexed collections Keyed collections Working with objects Using classes Using promises JavaScript typed arrays Iterators and generators Meta programming JavaScript modules Intermediate Client-side JavaScript frameworks Client-side web APIs Language overview JavaScript data structures Equality comparisons and sameness Enumerability and ownership of properties Closures Advanced Inheritance and the prototype chain Memory Management Concurrency model and Event Loop References Built-in objects OverviewAggregateErrorArrayArrayBufferAsyncFunctionAsyncGeneratorAsyncGeneratorFunctionAsyncIteratorAtomicsBigIntBigInt64ArrayBigUint64ArrayBooleanDataViewDatedecodeURI()decodeURIComponent()encodeURI()encodeURIComponent()Errorescape() Deprecated eval()EvalErrorFinalizationRegistryFloat16ArrayFloat32ArrayFloat64ArrayFunctionGeneratorGeneratorFunctionglobalThisInfinityInt16ArrayInt32ArrayInt8ArrayInternalError Non-standard IntlisFinite()isNaN()IteratorJSONMapMathNaNNumberObjectparseFloat()parseInt()PromiseProxyRangeErrorReferenceErrorReflectRegExpSetSharedArrayBufferStringSymbolSyntaxErrorTypedArrayTypeErrorUint16ArrayUint32ArrayUint8ArrayUint8ClampedArrayundefinedunescape() Deprecated URIErrorWeakMapWeakRefWeakSet Expressions & operators OverviewAddition (+)Addition assignment (+=)Assignment (=)async function expressionasync function* expressionawaitBitwise AND (&)Bitwise AND assignment (&=)Bitwise NOT (~)Bitwise OR (|)Bitwise OR assignment (|=)Bitwise XOR (^)Bitwise XOR assignment (^=)class expressionComma operator (,)Conditional (ternary) operatorDecrement (--)deleteDestructuring assignmentDivision (/)Division assignment (/=)Equality (==)Exponentiation (**)Exponentiation assignment (**=)function expressionfunction* expressionGreater than (>)Greater than or equal (>=)Grouping operator ( )import.metaimport()inIncrement (++)Inequality (!=)instanceofLeft shift (<<)Left shift assignment (<<=)Less than (<)Less than or equal (<=)Logical AND (&&)Logical AND assignment (&&=)Logical NOT (!)Logical OR (||)Logical OR assignment (||=)Multiplication (*)Multiplication assignment (*=)newnew.targetnullNullish coalescing assignment (??=)Nullish coalescing operator (??)Object initializerOperator precedenceOptional chaining (?.)Property accessorsRemainder (%)Remainder assignment (%=)Right shift (>>)Right shift assignment (>>=)Spread syntax (...)Strict equality (===)Strict inequality (!==)Subtraction (-)Subtraction assignment (-=)superthistypeofUnary negation (-)Unary plus (+)Unsigned right shift (>>>)Unsigned right shift assignment (>>>=)void operatoryieldyield* Statements & declarations Overviewasync functionasync function*Block statementbreakclassconstcontinuedebuggerdo...whileEmpty statementexportExpression statementforfor await...offor...infor...offunctionfunction*if...elseimportLabeled statementletreturnswitchthrowtry...catchvarwhilewith Deprecated Functions OverviewArrow function expressionsDefault parametersgetMethod definitionsRest parameterssetThe arguments object Classes OverviewconstructorextendsPrivate propertiesPublic class fieldsstaticStatic initialization blocks Regular expressions OverviewBackreference: \1, \2Capturing group: (...)Character class escape: \d, \D, \w, \W, \s, \SCharacter class: [...], [^...]Character escape: \n, \u{...}Disjunction: |Input boundary assertion: ^, $Literal character: a, bLookahead assertion: (?=...), (?!...)Lookbehind assertion: (?<=...), (?Named capturing group: (?...)Non-capturing group: (?:...)Quantifier: *, +, ?, {n}, {n,}, {n,m}Unicode character class escape: \p{...}, \P{...}Wildcard: .Word boundary assertion: \b, \B Errors OverviewAggregateError: No Promise in Promise.any was resolvedError: Permission denied to access property "x"InternalError: too much recursionRangeError: argument is not a valid code pointRangeError: BigInt division by zeroRangeError: BigInt negative exponentRangeError: form must be one of 'NFC', 'NFD', 'NFKC', or 'NFKD'RangeError: invalid array lengthRangeError: invalid dateRangeError: precision is out of rangeRangeError: radix must be an integerRangeError: repeat count must be less than infinityRangeError: repeat count must be non-negativeRangeError: x can't be converted to BigInt because it isn't an integerReferenceError: "x" is not definedReferenceError: assignment to undeclared variable "x"ReferenceError: can't access lexical declaration 'X' before initializationReferenceError: deprecated caller or arguments usageReferenceError: must call super constructor before using 'this' in derived class constructorReferenceError: super() called twice in derived class constructorSyntaxError: 'arguments'/'eval' can't be defined or assigned to in strict mode codeSyntaxError: "0"-prefixed octal literals are deprecatedSyntaxError: "use strict" not allowed in function with non-simple parametersSyntaxError: "x" is a reserved identifierSyntaxError: \ at end of patternSyntaxError: a declaration in the head of a for-of loop can't have an initializerSyntaxError: applying the 'delete' operator to an unqualified name is deprecatedSyntaxError: arguments is not valid in fieldsSyntaxError: await is only valid in async functions, async generators and modulesSyntaxError: await/yield expression can't be used in parameterSyntaxError: cannot use `??` unparenthesized within `||` and `&&` expressionsSyntaxError: character class escape cannot be used in class range in regular expressionSyntaxError: continue must be inside loopSyntaxError: duplicate capture group name in regular expressionSyntaxError: duplicate formal argument xSyntaxError: for-in loop head declarations may not have initializersSyntaxError: function statement requires a nameSyntaxError: functions cannot be labelledSyntaxError: getter and setter for private name #x should either be both static or non-staticSyntaxError: getter functions must have no argumentsSyntaxError: identifier starts immediately after numeric literalSyntaxError: illegal characterSyntaxError: import declarations may only appear at top level of a moduleSyntaxError: incomplete quantifier in regular expressionSyntaxError: invalid assignment left-hand sideSyntaxError: invalid BigInt syntaxSyntaxError: invalid capture group name in regular expressionSyntaxError: invalid character in class in regular expressionSyntaxError: invalid class set operation in regular expressionSyntaxError: invalid decimal escape in regular expressionSyntaxError: invalid identity escape in regular expressionSyntaxError: invalid named capture reference in regular expressionSyntaxError: invalid property name in regular expressionSyntaxError: invalid range in character classSyntaxError: invalid regexp groupSyntaxError: invalid regular expression flag "x"SyntaxError: invalid unicode escape in regular expressionSyntaxError: JSON.parse: bad parsingSyntaxError: label not foundSyntaxError: missing : after property idSyntaxError: missing ) after argument listSyntaxError: missing ) after conditionSyntaxError: missing ] after element listSyntaxError: missing } after function bodySyntaxError: missing } after property listSyntaxError: missing = in const declarationSyntaxError: missing formal parameterSyntaxError: missing name after . operatorSyntaxError: missing variable nameSyntaxError: negated character class with strings in regular expressionSyntaxError: new keyword cannot be used with an optional chainSyntaxError: nothing to repeatSyntaxError: numbers out of order in {} quantifier.SyntaxError: octal escape sequences can't be used in untagged template literals or in strict mode codeSyntaxError: parameter after rest parameterSyntaxError: private fields can't be deletedSyntaxError: property name __proto__ appears more than once in object literalSyntaxError: raw bracket is not allowed in regular expression with unicode flagSyntaxError: redeclaration of formal parameter "x"SyntaxError: reference to undeclared private field or method #xSyntaxError: rest parameter may not have a defaultSyntaxError: return not in functionSyntaxError: setter functions must have one argumentSyntaxError: string literal contains an unescaped line breakSyntaxError: super() is only valid in derived class constructorsSyntaxError: tagged template cannot be used with optional chainSyntaxError: Unexpected '#' used outside of class bodySyntaxError: Unexpected tokenSyntaxError: unlabeled break must be inside loop or switchSyntaxError: unparenthesized unary expression can't appear on the left-hand side of '**'SyntaxError: use of super property/member accesses only valid within methods or eval code within methodsSyntaxError: Using //@ to indicate sourceURL pragmas is deprecated. Use //# insteadTypeError: 'x' is not iterableTypeError: "x" is (not) "y"TypeError: "x" is not a constructorTypeError: "x" is not a functionTypeError: "x" is not a non-null objectTypeError: "x" is read-onlyTypeError: BigInt value can't be serialized in JSONTypeError: calling a builtin X constructor without new is forbiddenTypeError: can't access/set private field or method: object is not the right classTypeError: can't assign to property "x" on "y": not an objectTypeError: can't convert BigInt to numberTypeError: can't convert x to BigIntTypeError: can't define property "x": "obj" is not extensibleTypeError: can't delete non-configurable array elementTypeError: can't redefine non-configurable property "x"TypeError: can't set prototype of this objectTypeError: can't set prototype: it would cause a prototype chain cycleTypeError: cannot use 'in' operator to search for 'x' in 'y'TypeError: class constructors must be invoked with 'new'TypeError: cyclic object valueTypeError: derived class constructor returned invalid value xTypeError: getting private setter-only propertyTypeError: Initializing an object twice is an error with private fields/methodsTypeError: invalid 'instanceof' operand 'x'TypeError: invalid Array.prototype.sort argumentTypeError: invalid assignment to const "x"TypeError: Iterator/AsyncIterator constructor can't be used directlyTypeError: matchAll/replaceAll must be called with a global RegExpTypeError: More arguments neededTypeError: null/undefined has no propertiesTypeError: property "x" is non-configurable and can't be deletedTypeError: Reduce of empty array with no initial valueTypeError: setting getter-only property "x"TypeError: WeakSet key/WeakMap value 'x' must be an object or an unregistered symbolTypeError: X.prototype.y called on incompatible typeURIError: malformed URI sequenceWarning: -file- is being assigned a //# sourceMappingURL, but already has oneWarning: unreachable code after return statement Misc JavaScript technologies overview Lexical grammar Iteration protocols Strict mode Template literals Trailing commas Deprecated features In this articleTutorialsReferenceJavaScriptJavaScript (JS) is a lightweight interpreted (or just-in-time compiled) programming language with first-class functions. While it is most well-known as the scripting language for Web pages, many non-browser environments also use it, such as Node.js, Apache CouchDB and Adobe Acrobat. JavaScript is a prototype-based, multi-paradigm, single-threaded, dynamic language, supporting object-oriented, imperative, and declarative (e.g. functional programming) styles. JavaScript's dynamic capabilities include runtime object construction, variable parameter lists, function variables, dynamic script creation (via eval), object introspection (via for...in and Object utilities), and source-code recovery (JavaScript functions store their source text and can be retrieved through toString()). This section is dedicated to the JavaScript language itself, and not the parts that are specific to Web pages or other host environments. For information about APIs that are specific to Web pages, please see Web APIs and DOM. The standards for JavaScript are the ECMAScript Language Specification (ECMA-262) and the ECMAScript Internationalization API specification (ECMA-402). As soon as one browser implements a feature, we try to document it. This means that cases where some proposals for new ECMAScript features have already been implemented in browsers, documentation and examples in MDN articles may use some of those new features. Most of the time, this happens between the stages 3 and 4, and is usually before the spec is officially published. Do not confuse JavaScript with the Java programming language — JavaScript is not "Interpreted Java". Both "Java" and "JavaScript" are trademarks or registered trademarks of Oracle in the U.S. and other countries. However, the two programming languages have very different syntax, semantics, and use. JavaScript documentation of core language features (pure ECMAScript, for the most part) includes the following: The JavaScript guide The JavaScript reference For more information about JavaScript specifications and related technologies, see JavaScript technologies overview.TutorialsLearn how to program in JavaScript with guides and tutorials.For complete beginnersHead over to our Learning Area JavaScript topic if you want to learn JavaScript but have no previous experience with JavaScript or programming. The complete modules available there are as follows: JavaScript first steps Answers some fundamental questions such as "what is JavaScript?", "what does it look like?", and "what can it do?", along with discussing key JavaScript features such as variables, strings, numbers, and arrays. JavaScript building blocks Continues our coverage of JavaScript's key fundamental features, turning our attention to commonly-encountered types of code blocks such as conditional statements, loops, functions, and events. Introducing JavaScript objects The object-oriented nature of JavaScript is important to understand if you want to go further with your knowledge of the language and write more efficient code, therefore we've provided this module to help you. Asynchronous JavaScript Discusses asynchronous JavaScript, why it is important, and how it can be used to effectively handle potential blocking operations such as fetching resources from a server. Client-side web APIs Explores what APIs are, and how to use some of the most common APIs you'll come across often in your development work. JavaScript guide JavaScript Guide A much more detailed guide to the JavaScript language, aimed at those with previous programming experience either in JavaScript or another language. Intermediate Understanding client-side JavaScript frameworks JavaScript frameworks are an essential part of modern front-end web development, providing developers with proven tools for building scalable, interactive web applications. This module gives you some fundamental background knowledge about how client-side frameworks work and how they fit into your toolset, before moving on to a series of tutorials covering some of today's most popular ones. JavaScript language overview An overview of the basic syntax and semantics of JavaScript for those coming from other programming languages to get up to speed. JavaScript data structures Overview of available data structures in JavaScript. Equality comparisons and sameness JavaScript provides three different value comparison operations: strict equality using ===, loose equality using ==, and the Object.is() method. Enumerability and ownership of properties How different methods that visit a group of object properties one-by-one handle the enumerability and ownership of properties. Closures A closure is the combination of a function and the lexical environment within which that function was declared. Advanced Inheritance and the prototype chain Explanation of the widely misunderstood and underestimated prototype-based inheritance. Memory Management Memory life cycle and garbage collection in JavaScript. The event loop JavaScript has a runtime model based on an "event loop". ReferenceBrowse the complete JavaScript reference documentation. Standard objects Get to know standard built-in objects Array, Boolean, Date, Error, Function, JSON, Math, Number, Object, RegExp, String, Map, Set, WeakMap, WeakSet, and others. Expressions and operators Learn more about the behavior of JavaScript's operators instanceof, typeof, new, this, the operator precedence, and more. Statements and declarations Learn how do-while, for-in, for-of, try-catch, let, var, const, if-else, switch, and more JavaScript statements and keywords work. Functions Learn how to work with JavaScript's functions to develop your applications. Classes JavaScript classes are the most appropriate way to do object-oriented programming. Help improve MDNWas this page helpful to you?YesNoLearn how to contribute.This page was last modified on Mar 5, 2024 by MDN contributors.View this page on GitHub • Report a problem with this contentMDN logoYour blueprint for a better internet.MDN on MastodonMDN on X (formerly Twitter)MDN on GitHubMDN Blog RSS FeedMDNAboutBlogCareersAdvertise with usSupportProduct helpReport an issueOur communitiesMDN CommunityMDN ForumMDN ChatDevelopersWeb TechnologiesLearn Web DevelopmentMDN PlusHacks BlogMozilla logoWebsite Privacy NoticeCookiesLegalCommunity Participation GuidelinesVisit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.Portions of this content are ©1998–2024 by individual mozilla.org contributors. Content available under a Creative Commons license.
en
us
en-US
1728730561
https://mdn.io

Editja s-sit tiegħek?

X'qed tagħmel?

0.0053911209106445


Webdirectory
Webdirectory

Webdirectory
JavaScript (JS) is a lightweight interpreted (or just-in-time compiled) programming language with first-class functions. While it is most we...
Webdirectory