Quotes help make search much faster. Example: "Practice Makes Perfect"

Thursday, January 31, 2013

Codecademy: String Reversal - Part 1



// Sample solution

var date = "2012-03-16";

// split the date by "-"
var date_as_array = date.split('-');

// reverse the order of elements in the array
var reversed_array = date_as_array.reverse();

// convert the reversed array back to a string using
// the join() method with "/" as separator
var converted_date = reversed_array.join('/');

No comments:

Post a Comment


This is an example of scrolling text using Javascript.

Popular Posts