Skip to content

Instantly share code, notes, and snippets.

View ajnadel's full-sized avatar

AJ Nadel ajnadel

View GitHub Profile
@ajnadel
ajnadel / mass.js
Created February 11, 2015 23:29 — forked from anonymous/mass.js
var is2through9 = /[2-9]/;
var genElement = function(elm){
var elementCount = 1;
var lastChar = elm[elm.length-1];
if (is2through9.test(lastChar)){
elementCount = lastChar; /* add coefficient */
elm = elm.slice(0, -1);
}
return [elementCount, elm];