|Two things I think you need to focus on learning: Console Log, and Typeof.
Console = press F12 and look at the "Console". (Except IE because IE still sucks)
So you can try your first one with this:
This is rather important as next thing to try to see if a value is an Integer or not is this:
That should tell you Integer or String or Array. If you try to add a String to an Integer you get a hybrid and the Int is converted to a string.
var myVar = "Hello" + 12345;
The output of that will be "Hello12345" Happens with Numbers also, which is when you end up with NaN or "Not a Number" which can be checked with "isNaN(var)".
So lets say you have this:
var varA = 10;
var varB = "20";
var sum = varA + varB;
Did you notice the quotes on varB? It means that although there are numeric characters in it, the variable is treated like a String, which causes varA to be typecast to a String. Your output there would be "1020" not the 30 like you expect.
Back to the console for just a moment. If you need to check the value of a variable or object or something in your code without jumping thru a thousand hoops to even see what that is, you can "LOG" that. In the console you can type your variable name. Simply type "varA" without the quotes and the console will output whatever the VALUE of varA is. You can also try putting in "typeof varA" (again, no quotes) and see if the VALUE is an integer or string, which is where I think you have the most trouble!
It doesnt fix your problem, but I hope this helps to undestand what the problem is and some of the tools you have available to you!