3 ms·
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 liv
by noncoml 8y ago
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.
- paulintrognon 8y agohidestory() is not even used anywhere ; why is it here for? Debugging?
- joshschreuder 8y agoIt is probably called in an onclick=“” in the HTML somewhere
- wiether 8y agoLike JS is never attached to a HTML template ?
- fenomas 8y agoIt's called by the "hide" link under each story on the top page.
- bausshf 8y agoIs this sarcasm? I hope it is.
- xigma 8y agoExcept 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.