Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
tomando3097y@PaddiM8 well hey, if I'm retarded enough to code that, why not go all the way?
Also I couldn't be bothered opening it on my laptop, my phone was right there aaaand my actual code is probably just as embarrassing lol -
Dacexi119967y
-
Dacexi119967y@tomando the function would call itself so many times without resolving it which would use up heap until the program crashes.
-
tomando3097y@Dacexi haha I get you now. That's pretty much what happened except it was running in chrome so it's sandboxed and crashed itself
-
JavaScript will throw an error if it's a function calling itself till infinity. Also I think it'll error on first loop, because it doesn't pass the argument. I might be wrong on that
-
tomando3097y@matsaki95 it just crashed itself with a an error. Since it's sandboxed in Google Chrome (and probably all browsers?) the script can only be a certain size before its stopped. In this case the call stack got too large (every time a function is called, the caller is added to a call stack so it can be popped off again when the function returns) so it crashed the script. There's no need for a call stack 200 calls long in a browser because more than likely you've over complicated it by then
-
tomando3097y@ChainsawBaby nah js is pretty chill with arguments. If you don't supply an argument it'll just set it to undefined if the function references it. I'd need to check about passing in extra functions but I'm 99% sure it doesn't matter either. The engine won't pick up the error in the script until it's running it, because the call stack gets too large
Related Rants
The first stage of fatigue. I would've loved to know my reasoning behind why I put wrote this
undefined
whathaveidone