I’m working on this right now and I’m having trouble with jQuery. I’m a bit stumped as to why the if statement on line 10 isn’t working. When I console log the comparison, it comes up as NaN, which makes sense. However, when I make the variable === NaN statement, none of the code works. I thought it was the selector at first, but I tested it below and that works fine.
Side note, I also can’t figure out why my Buy button wont center.
Welcome to the JS world of nuances. NaN === NaN will be false, so use
isNaN(var) instead to check for NaN.
NaN on MDN
Why NaN === NaN is false in stackoverlfow
You can also check in the console (or) search in stack overflow if you see anything wierd.
Thanks so much for the help! I spent so much time thinking I forgot to include something or my syntax was wrong that I forgot to read up on the details.
Glad that I could help. To align the “Buy” button in the center add the
center-block class to the element.
Class for “Buy” element would be like “buy btn center-block btn-danger”.