News for hackers. Stuff that matters.
Re:How true hackers write JavaScript by noncoml on Wednesday September 05, 2018 @04:31AM (#17916076)

    function hidestory (ev, el, id) {
      for (var i=0; i < 3; i++) {
That 3 there is the problem with “simple” JS. It’s tightly coupled to the HTML but they live in completely different places.

On a side note this 3 should be at least assigned to a variable with a meaningful name.

Re:How true hackers write JavaScript by xigma on Wednesday September 05, 2018 @07:07AM (#17916812)
Except there isn't any problem here whatsoever. Yes, it's coupled, but it doesn't matter. No, this kind of code doesn't scale. It doesn't have to.

The time you spent writing this comment was longer than what it took writing this code. Considering what kind of site this is, that code may work indefinitely. Or, if necessary, someone from the future will need to change that 3 to a 4 at some point. In terms of total cost, it's almost certainly the cheapest solution.

Re:How true hackers write JavaScript by bsaul on Wednesday September 05, 2018 @09:10AM (#17917536)
And how will that someone know what that 3 stands for ? At the minimum a comment above that line would have been nice.
Re:How true hackers write JavaScript by xigma on Wednesday September 05, 2018 @12:02PM (#17919153)
They'll figure it out. They're a programmer, figuring things out is their job.
Re:How true hackers write JavaScript by paulintrognon on Wednesday September 05, 2018 @04:34AM (#17916091)
hidestory() is not even used anywhere ; why is it here for? Debugging?
Re:How true hackers write JavaScript by fenomas on Wednesday September 05, 2018 @05:27AM (#17916356)
It's called by the "hide" link under each story on the top page.
Re:How true hackers write JavaScript by joshschreuder on Wednesday September 05, 2018 @04:50AM (#17916184)
It is probably called in an onclick=“” in the HTML somewhere
Re:How true hackers write JavaScript by wiether on Wednesday September 05, 2018 @05:14AM (#17916300)
Like JS is never attached to a HTML template ?
Re:How true hackers write JavaScript by bausshf on Wednesday September 05, 2018 @05:44AM (#17916427)
Is this sarcasm? I hope it is.