0
navster
8y

Can anyone explain why in JS this >= when written like => works in some browsers and not others? What is the latter? Other than an incorrect syntax when doing a comparison of greater than or equal to?

Comments
  • 0
    My guess is some browsers have more forgiving JavaScript engines. Like how each browser handles HTML differently, some will try to guess what was supposed to be there if you have a small syntax error.
  • 1
    I think you might be right. This caught me out royally today. iOS 10 must be shipped with the latest version of WebKit installed and allowed this. iOS 9 does not, however. I was debugging a hybrid app in Chrome and iOS 10... Moral of the story, test on everything!!
  • 0
    @rtannerf oh really... so what the heck was it trying to achieve if I was 'aiming' to compare something to something else 😕
  • 1
    @rtannerf I see! That makes perfect sense, thank you! I was starting to go slightly mad I must admit. Makes sense that Apple has upgraded WebKit with some ES6 support in their latest update I guess. Indeed, too clever for its own good...
  • 0
    @rtannerf That explanation makes a lot more sense than mine :)
  • 0
    @rtannerf even more interesting is that the value of oranges doesn't matter as you never execute the function, so it always resolves to true for the if statement
Add Comment