Live data from Hacker News

Search: .lenght - Github

github.com

1–10 of 106 posts

Re: Search: .lenght - Github

#4
post #2

A common typo, it seems. But I'm a bit confused as to why this was submitted.

In JavaScript, if you check for a non-existent property on a variable (e.g. aVar.lenght vs aVar.length) it will return "undefined". So people often rely on this behaviour to check if something is an array or not (no comment on whether this is good or bad), with:

    if(somethingThatMightBeAnArray.length){
        // do things with array
    }
So misspelling of length can be making a lot of code out there behave in an unexpected way.

Re: Search: .lenght - Github

#5
post #2

A common typo, it seems. But I'm a bit confused as to why this was submitted.

In a static language this would be flagged as an error. I assume something less than ideal happens in languages such as Ruby.

I once worked at a company where a very early piece of code had a typo "properites" instead of "properties". This misspelling became institutionalized, and was used throughout the codebase because it was deemed too expensive to fix. And this was with a static language (with good IDE refactoring support)!

Re: Search: .lenght - Github

#9
post #2

A common typo, it seems. But I'm a bit confused as to why this was submitted.

In a static language this would be flagged as an error. I assume something less than ideal happens in languages such as Ruby. I once worked at a company where a very early piece of code had a typo "properites" instead of "properties". This misspelling became institutionalized, and was used throughout the codebase because it was deemed too expensive to fix. And this was with a static language (with good IDE refactorin…

I'm confused as to why they couldn't simply:

  grep -R properites .

Re: Search: .lenght - Github

#10
post #9

Earlier quoted context omitted.

In a static language this would be flagged as an error. I assume something less than ideal happens in languages such as Ruby. I once worked at a company where a very early piece of code had a typo "properites" instead of "properties". This misspelling became institutionalized, and was used throughout the codebase because it was deemed too expensive to fix. And this was with a static language (with good IDE refactorin…

I'm confused as to why they couldn't simply: grep -R properites .

Perhaps they were using . . . something other than *nix.

EDIT: Justly downvoted chastised for attempting humor without understanding.

Post reply on HN