Adding large number in JavaScript

Today i had an Interview with one of the company and interviewer guy (Ritesh) asked me very simple problem that “How will you add two numbers if numbers are very large/Add large number in JavaScript?”. Frankly saying, i never gave a thought about this problem ever. My interviewer didn’t got got impressed but still i thought of solving it. So below id the function that i have coded for it. Problem: Javascript support at most 53 bit of integer only. If number goes beyond it, Javascript loose precision.  Small number can be added simply as follow:

But if you try …

Continue Reading