Naming an input field 'Date' screws up javascript intellisense in my Visual Studio 2012. Makes me wonder if this is considered bad practice?

<script>
    var d = new Date();
    d. <-- no intellisense
</script>
<input type="text" name="Date" />
有帮助吗?

解决方案

Normally it's better not to use languages reserved words, there are sometimes ways to scape them, but it could confuse yourself in the future if you need to modify something anyway, or even worse, if somebody else needs to modify your work.

You can always use intuitive prefixes for example:

myDate
inputDate
formDate
etc
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top