Avatar

Correct answer by
Level 4

Hi @shri91127 ,

You are using the same variable name with the variable declaration format (means adding the var). Javascript has a feature called variable hoisting. This will move all variable declarations to the top of the scope. So when you call formatDate function, the data type of NovDate would be string. Try removing var from the line having formatDate function call. 

View solution in original post