var e = nerdamer('(x^2+1)/(x-1)'); var numerator = e.numerator().toString(); console.log(numerator); e = nerdamer('2/5'); numerator = e.numerator().toString(); console.log(numerator);