// ES5
var parts = '2010-11-11'.split('-'),
year = parts[0],
month = parts[1],
day = parts[2];
// ES6
var [year, month, day] = '2010-10-11'.split('-');
console.log(year); // 2010
console.log(month); // 10
console.log(day); // 11
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.