Pergunta

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" />
Foi útil?

Solução

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
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top