javascript ... operator
JavaScript
//The operator ... is part of the array destructuring.
//It's used to extract info from arrays to single variables.
//The operator ... means "the rest of the array".
var [head, ...tail] = ["Hello", "I" , "am", "Sarah"];
console.log(head);//"Hello"
console.log(tail);//["I", "am", "Sarah"]
//It can be used to pass an array as a list of function arguments
let a = [2,3,4];
Math.max(a) //--> NaN
Math.max(...a) //--> 4/* JavaScript shorthand -=
-= is shorthand to subtract something from a
variable and store the result as that same variable.
*/
// The standard syntax:
var myVar = 5;
console.log(myVar) // 5
var myVar = myVar - 3;
console.log(myVar) // 2
// The shorthand:
var myVar = 5;
console.log(myVar) // 5
var myVar -= 3;
console.log(myVar) // 2
Operator Example Same As
= x = y x = y
+= x += y x = x + y
-= x -= y x = x - y
*= x *= y x = x * y
/= x /= y x = x / y
%= x %= y x = x % y
**= x **= y x = x ** y
Also in JavaScript:
- Title
- angular add debounce time before putting valu in subject next
- Category
- JavaScript
- Title
- can we import jquery library from developer tools
- Category
- JavaScript
- Title
- javascript array remove duplicates
- Category
- JavaScript
- Title
- array javascript
- Category
- JavaScript
- Title
- javascript click
- Category
- JavaScript
- Title
- get selected text js
- Category
- JavaScript
- Title
- defining props in react
- Category
- JavaScript
- Title
- basic javascript
- Category
- JavaScript
- Title
- javascript add option element to select
- Category
- JavaScript
- Title
- console log all array values node
- Category
- JavaScript
- Title
- generate bearer token
- Category
- JavaScript
- Title
- fs create or edit file
- Category
- JavaScript
- Title
- iterate over object javascript
- Category
- JavaScript
- Title
- get attribute value jquery href
- Category
- JavaScript
- Title
- import dropdown react
- Category
- JavaScript
- Title
- how to remove a property from an object in javascript
- Category
- JavaScript
- Title
- javascript adding an array to an array
- Category
- JavaScript
- Title
- angular transition animation
- Category
- JavaScript
- Title
- angular bootstrap not working
- Category
- JavaScript
- Title
- greater than or equal to javascript
- Category
- JavaScript
- Title
- enable disable click on div jquery
- Category
- JavaScript
- Title
- Getting the differences between two objects javascript lib
- Category
- JavaScript
- Title
- javascript check if number
- Category
- JavaScript
- Title
- javascript array exists check
- Category
- JavaScript
- Title
- how to have your discord bot send two message
- Category
- JavaScript
- Title
- body-parser node
- Category
- JavaScript
- Title
- getboundingclientrect() javascript
- Category
- JavaScript
- Title
- indexof javascript
- Category
- JavaScript
- Title
- how to rescale a canvas in html5 without blurrriness
- Category
- JavaScript
- Title
- javascript ajax request
- Category
- JavaScript
- Title
- integers to space separated string in javascript
- Category
- JavaScript
- Title
- error Invalid regular expression: /(.*\\__fixtures__\\.*|node_modules[\\\]react[\\\]dist[\\\].*|website\\node_modules\\.*|heapCapture\\bundle\.js|.*\\__tests__\\.*)$/: Unterminated character class.
- Category
- JavaScript
- Title
- express render
- Category
- JavaScript
- Title
- How can I upload files asynchronously
- Category
- JavaScript
- Title
- how to make text come up with javascript
- Category
- JavaScript
- Title
- how to set three js canvas width 100%
- Category
- JavaScript
- Title
- create table jquery
- Category
- JavaScript
- Title
- atom javascript es6 linter
- Category
- JavaScript
- Title
- form taglib in jsp
- Category
- JavaScript
- Title
- javascript ascending and descending
- Category
- JavaScript
- Title
- how to send json data in fetch request body
- Category
- JavaScript
- Title
- href before onclick js
- Category
- JavaScript
- Title
- ${ js
- Category
- JavaScript
- Title
- comment obtenir l'élément parent javascript
- Category
- JavaScript
- Title
- how to Write a program that simulates a coin toss using random method of Javascript Math class
- Category
- JavaScript
- Title
- document load javascript
- Category
- JavaScript
- Title
- how to make javascript function consise
- Category
- JavaScript
- Title
- canvas container page offset
- Category
- JavaScript
- Title
- function js
- Category
- JavaScript
- Title
- how to save thing in cookie js
- Category
- JavaScript
- Title
- javascript .split().reverse.join
- Category
- JavaScript
- Title
- get today's date javascript
- Category
- JavaScript
- Title
- extend react.component
- Category
- JavaScript
- Title
- Encoding and Decoding Base64 Strings in Node.js
- Category
- JavaScript
- Title
- how to draw a triangle using javascript
- Category
- JavaScript
- Title
- angular countdown timer
- Category
- JavaScript
- Title
- async await javascript
- Category
- JavaScript
- Title
- get the current url javascript
- Category
- JavaScript
- Title
- javascript check if array is empty
- Category
- JavaScript
- Title
- get radio button value javascript
- Category
- JavaScript
- Title
- angular @Output()
- Category
- JavaScript
- Title
- columndefs in datatable not working while setting width jquery
- Category
- JavaScript
- Title
- array spread operator in javascript
- Category
- JavaScript
- Title
- bootstrap datepicker format dd-mm-yyyy
- Category
- JavaScript
- Title
- Angular material design
- Category
- JavaScript
- Title
- access angular app outside localhost
- Category
- JavaScript
- Title
- add dynamic value to id attribute in angular 8
- Category
- JavaScript
- Title
- change node version
- Category
- JavaScript
- Title
- compare dates in javascript
- Category
- JavaScript
- Title
- how to link javascript to html
- Category
- JavaScript
- Title
- how to use local static images in svelte
- Category
- JavaScript
- Title
- api platform vue generator
- Category
- JavaScript
- Title
- butonc click jquery
- Category
- JavaScript
- Title
- Data Change with Mutation
- Category
- JavaScript
- Title
- javaScript Age in Dog years //write a function that takes your age and returns it to you in dog years - they say that 1 human year is equal to seven dog years function dog Years() javaScript
- Category
- JavaScript
- Title
- how to clear radio field in jquery
- Category
- JavaScript
- Title
- convert jquery to javascript
- Category
- JavaScript
- Title
- checkbox click event jquery
- Category
- JavaScript
- Title
- how to convert json to bootstrap treeview format
- Category
- JavaScript
- Title
- how to add class to button in javascript
- Category
- JavaScript
- Title
- how to instance in a node with code godot
- Category
- JavaScript
- Title
- javascript change url
- Category
- JavaScript
- Title
- javascript array flatten
- Category
- JavaScript
- Title
- device height react native
- Category
- JavaScript
- Title
- case in javascript
- Category
- JavaScript
- Title
- convert array object to string javascript
- Category
- JavaScript
- Title
- include gif in react
- Category
- JavaScript
- Title
- angular interview questions
- Category
- JavaScript
- Title
- if statement in javascript
- Category
- JavaScript
- Title
- how to make a factorial function in javascript
- Category
- JavaScript
- Title
- cannot use getidtoken if null
- Category
- JavaScript
- Title
- javascript canvas beziercurveto
- Category
- JavaScript
- Title
- cortar elemento y pegar en otro lugar jquery
- Category
- JavaScript
- Title
- closure javascript
- Category
- JavaScript
- Title
- hot get access_token instead of url
- Category
- JavaScript
- Title
- how to set json type jquery ajax
- Category
- JavaScript
- Title
- docker node label add
- Category
- JavaScript
- Title
- create element javascript with class
- Category
- JavaScript
- Title
- iterate over array of object javascript and access the properties
- Category
- JavaScript
- Title
- disregard empty field in array
- Category
- JavaScript