Javascript 1.7 added destructuring assignment which allows you to do essentially what you are after.
function getTuple(){ return ["Bob", 24]; } var [a, b] = getTuple(); // a === "bob" , b === 24 are both true
Related Posts:
- Cannot set property InnerHTML of null [duplicate]
- How can I submit a form using JavaScript?
- How do I get the current date in JavaScript?
- How to do a redirect to another route with react-router?
- Jest spy on functionality
- Use a JSON array with objects with javascript
- Toggle show/hide on click with jQuery
- JavaScript string newline character?
- How to create a GUID / UUID
- How does “/\s/g” replace spaces with other characters?
- What is the correct way to check for string equality in JavaScript?
- JavaScript TypeError: Cannot read property ‘style’ of null
- How to obtain username from Promise
? - How do you check if a variable is an array in JavaScript?
- Number converted in 1e+30
- Static variables in JavaScript
- ReferenceError : window is not defined at object.
Node.js - Node.js Port 3000 already in use but it actually isn’t?
- Uncaught TypeError: $.post is not a function
- Unable to verify leaf signature
- When and why to ‘return false’ in JavaScript?
- In angularjs we are having ng-disabled directive, why ng-enabled directive is not provided by the framework as we are having ng-show and ng-hide
- XML Parsing Error: no root element found Location in Console FF
- TypeError: app.use() requires middleware functions
- Possible to extend types in Typescript?
- document.getElementByID is not a function
- No overload matches this call. Type ‘string’ is not assignable to type ‘Signals’
- Moment js date time comparison
- window.variableName
- What does ${} (dollar sign and curly braces) mean in a string in Javascript?
- How to implement authenticated routes in React Router 4?
- How to create a JQuery Clock / Timer
- XMLHttpRequest status 0 (responseText is empty)
- What is the meaning of || in javascript?
- Coin toss with JavaScript and HTML
- Does JavaScript support array/list comprehensions like Python?
- Play an audio file using jQuery when a button is clicked
- How can I get the last character in a string?
- getBoundingClientRect is not a function
- Is there a simple way to create a javascript lookup table?
- Disable Chrome strict MIME type checking
- Why am I getting “ReferenceError: getElementById is not defined”?
- Can a for loop increment/decrement by more than one?
- Example JavaScript code to parse CSV data
- addEventListener not working in javascript
- How to access the request body when POSTing using Node.js and Express?
- How do I check whether a checkbox is checked in jQuery?
- Convert normal date to unix timestamp
- jQuery replace one class with another
- Clearing my form inputs after submission
- Scope Chain in Javascript
- Changing the image source using jQuery
- Reload an iframe with jQuery
- JavaScript pattern for multiple constructors
- How to manage a redirect request after a jQuery Ajax call
- how to write javascript code inside php
- javascript convert int to float
- Uncaught TypeError: Cannot read property ‘toLowerCase’ of undefined
- How do I convert a JavaScript forEach loop/function to CoffeeScript
- ZIP Code (US Postal Code) validation
- Is there a standard function to check for null, undefined, or blank variables in JavaScript?
- How to force JavaScript to deep copy a string?
- How to go to a URL using jQuery?
- Uncaught ReferenceError: ga is not defined
- Getting or changing CSS class property with Javascript using DOM style
- How to close a window using jQuery
- how to add inside a text box?
- is it posible to add anime.js in WordPress
- WP Rest API – How to get featured image
- How to only enqueue block javascript on the frontend when its needed [duplicate]
- What type of template are WP media-modal’s templates?
- Eliminate render blocking javascript
- is_front_page() not working
- The value of attribute [ data-type ] must be in double quotes – custom html widget error
- Gutenberg RichText
- Add tinymce dynamically via Javascript
- Sending custom data with Media Frame Model
- Make TinyMCE checkbox that returns a value instead of true/false
- Adding JavaScript to a WordPress website
- wp-env mysqlcheck error:1130
- How to disable inline css styles generated by Gutenberg editor?
- Multiple Conditional Controllers
- Adding javascript trigger to user role selection on the user-edit page
- Vue and wordpress.Bad Request ajax request
- How to add if lt IE9 conditional scripts to functions.php
- How to include a JSON file on my page?
- Adding inline JavaScript after wp_enqueue_scripts
- How to add “on change” to a text input in contact form7?
- Update media library attachments
- JavaScript Libraries in WordPress
- How to use WP switchEditors.switchto(this) JS function in your own script?
- Landing function through URL
- Escaping quotes while enqueuing scripts
- Create new product with woocommerce REST API with javascript (clientside)?
- Combining results from WP-API using AngularJS
- dropdown does not work [closed]
- Anyway to disable the auto excerpt creation?
- How do I cycle a JS function in WordPress? [closed]
- Why is this script not working?
- How can I look at/edit what’s being sent to post.php when I hit the publish/update button?