can anybody help and tell me why this
new Date(parseInt("1395427364000"))
works in the console but this
var testDate = new Date(parseInt("1395427364000"))
in the code gives me an invalid date
The console prints the return value of a statement. The return value of a var x = someValue
statement is not the value. If you later just call testDate
in the console, you'll indeed see its value.