Ccna final exam - java, php, javascript, ios, cshap all in one. This is a collaboratively edited question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.
There is, but in "new" versions of Javascript: Destructuring assignment - Javascript 1.7. It's probably only supported in Mozilla-based browsers, and maybe in Rhino.
var a = 1; var b = 3;
[a, b] = [b, a];
EDIT: actually it wouldn't surprise me if the V8 Javascript library (and thus Chrome) supports this. But don't count on it either :)
There is, but in "new" versions of Javascript: Destructuring assignment - Javascript 1.7. It's probably only supported in Mozilla-based browsers, and maybe in Rhino.
ReplyDeletevar a = 1;
var b = 3;
[a, b] = [b, a];
EDIT: actually it wouldn't surprise me if the V8 Javascript library (and thus Chrome) supports this. But don't count on it either :)
try this:
ReplyDeletematches = ['12', 'watt'];
[value, unit] = matches;
There is a experimental implementation of list() by PHPJS here:
ReplyDeletehttps://github.com/kvz/phpjs/blob/master/_experimental/array/list.js
Here's another way of accomplishing this:
ReplyDeletehttp://stackoverflow.com/a/9853132/675007