What is the basic difference between "var" keyword in Javascript and C# ?

Answer:

In C#, we have "dynamic" keyword. This dynamic keyword is somewhat similar to javascript's "var" . Here, both create a variable whose type will not be known until runtime, and whose misuse will not be discovered until runtime. C#'s var creates a variable whose type is known at compile time.

For example:-

dynamic dt= new DateTime();

dt.bar();


//compiles fine but gives an error at runtime

Tags : var keyword in c#,Jquery