Trying to put a limit on the length of a javascript object


Hi All,

I’m doing the javascript calculator project and I’m trying to stop numbers entered into my calculator from running out of the display div.

This is what I have so far:

if (result.toString().length > 16) {
result =

I don’t know how to cap the length of result at 16 characters.



you can try overflow rather than clearing the result; it will clip the overflow.

W3Schools - CSS