Вопрос

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