Skip to content

Instantly share code, notes, and snippets.

@antiboredom
Created December 8, 2015 19:55
Show Gist options
  • Save antiboredom/db0f424d1884c57e3f6f to your computer and use it in GitHub Desktop.
Save antiboredom/db0f424d1884c57e3f6f to your computer and use it in GitHub Desktop.
var tweet = "These 5 incredible stories from the IDF are sure to leave #inspired";
// turn tweet into an array
var words = tweet.split(" ");
// get half the length of the words
var half_length = Math.ceil(arrayName.length / 2);
// get the words on the left side
var leftSide = words.splice(0, half_length);
var leftWords = leftSide.join(" ");
// get the words on the right side
var rightWords = words.join(" ");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment