Sort Score
Result 10 results
Languages All
Labels All
Results 51 - 60 of 23,537 for

js

(0.05 sec)
  1. Trailing commas - JavaScript | MDN

    Trailing commas (sometimes called "final commas") can be useful when adding new elements, parameters, or properties to JavaScript code. If you want to add a new property, you can add a new line without modifying the previously last line if that line already uses a trailing comma. This makes version-control diffs cleaner and editing code might be less troublesome....trailing commas in array literals: js const arr = [ 1, 2, 3, ]; arr;...having multiple trailing commas. js const arr = [1, 2, 3, , ,]; arr...

    developer.mozilla.org/en-US/docs/Web/JavaScript...
  2. Quantifier: *, +, ?, {n}, {n,}, {n,m} - JavaScr...

    A quantifier repeats an atom a certain number of times. The quantifier is placed after the atom it applies to.... js const re = /a{1, 3}/; re.test("aa");...and you should not rely on it. js /a{1, 3}/u; // SyntaxError: Invalid...

    developer.mozilla.org/en-US/docs/Web/JavaScript...
  3. JavaScript object basics - Learn web developmen...

    Congratulations, you've reached the end of our first Js objects article — you should now have a good idea of how to work with objects in JavaScript — including creating your own simple objects. You should also appreciate that objects are very useful as structures for storing related data and functionality — if you tried to keep track of all the properties and methods in our person object as separate variables and functions, it would be inefficient and frustrating, and we'd run the risk of clashing with other variables and functions that have the same names. Objects let us keep the information safely locked away in their own package, out of harm's way.... then saving and refreshing: js const person = {}; Now open your...in our file to look like this: js const person = { name: ["Bob"...

    developer.mozilla.org/en-US/docs/Learn/JavaScri...
  4. Method definitions - JavaScript | MDN

    Method definition is a shorter syntax for defining a function property in an object initializer. It can also be used in classes.... Try it Syntax js ({ property(parameters) {}, ...syntax. Given the following code: js const obj = { foo: function ()...

    developer.mozilla.org/en-US/docs/Web/JavaScript...
  5. TypeError: 'x' is not iterable - JavaScript | MDN

    The JavaScript exception "is not iterable" occurs when the value which is spread into an array or function call, given as the right-hand side of for...of, as argument of a function such as Promise.all or Set(), or as the right-hand side of an array destructuring assignment, is not an iterable object. This error is also encountered when Array.fromAsync() or for await...of is used with a non-async iterable.... js const nonIterable1 = {}; const...destructuring a non-iterable js const myObj = { arrayOrObjProp1:...

    developer.mozilla.org/en-US/docs/Web/JavaScript...
  6. Using classes - JavaScript | MDN

    JavaScript is a prototype-based language — an object's behaviors are specified by its own properties and its prototype's properties. However, with the addition of classes, the creation of hierarchies of objects and the inheritance of properties and their values are much more in line with other object-oriented languages such as Java. In this section, we will demonstrate how objects can be created from classes....this may seem familiar to you : js const bigDay = new Date(2019...created with class declarations . js class MyClass { // class body...

    developer.mozilla.org/en-US/docs/Web/JavaScript...
  7. TypeError: can't access/set private field or me...

    The JavaScript exception "can't access private field or method: object is not the right class" or "can't set private field: object is not the right class" occurs when a private field or method is get or set on an object that does not have this private property defined.... js class MyClass { static #x = 0;...property with the same name. js class MyClass { #x = 0; doSomething()...

    developer.mozilla.org/en-US/docs/Web/JavaScript...
  8. SyntaxError: unlabeled break must be inside loo...

    The JavaScript exception "unlabeled break must be inside loop or switch" occurs when a break statement is not inside a loop or a switch statement.... js let score = 0; function increment()...to early-terminate a function. js let score = 0; function increment()...

    developer.mozilla.org/en-US/docs/Web/JavaScript...
  9. Greater than (>) - JavaScript | MDN

    The greater than (>) operator returns true if the left operand is greater than the right operand, and false otherwise.... Try it Syntax js x > y Description The operands...Examples String to string comparison js "a" > "b"; // false "a" > "a";...

    developer.mozilla.org/en-US/docs/Web/JavaScript...
  10. JavaScript language overview - JavaScript | MDN

    JavaScript is a multi-paradigm, dynamic language with types and operators, standard built-in objects, and methods. Its syntax is based on the Java and C languages — many structures from those languages apply to JavaScript as well. JavaScript supports object-oriented programming with object prototypes and classes. It also supports functional programming since functions are first-class objects that can be easily created via expressions and passed around like any other object.... js console.log(3 / 2); // 1.5, not...arithmetic can be imprecise. js console.log(0.1 + 0.2); // 0...

    developer.mozilla.org/en-US/docs/Web/JavaScript...