How to do integer division in javascript (Getting division answer in int not float)? var answer = Math.floor(x) I sincerely hope this will help future searchers when googling for this common question.