This is an important concept:
var i = 5; only ever sets the variable
5. It will never check values.
Next, there are two sets of two equality operators, which check values and return true or false.
!= are a one set of equality operators: these will check for equality after doing type conversions. This means that it will check for equality only after making sure both things being compared are the same type...for example, string vs string, int vs int, etc. This makes it, for the most part, a slower operator.
!== are the other set of equality operators: these will check for equality ignoring the type. This means it will check for equality, without regard to whether or not they are the thing type of object...for example, string vs int, int vs boolean, etc.
With these facts in mind, can you answer this: "what is wrong with your code?"?
The Answer Is...
You are using the wrong operator in your while loop.