If .startsWith (or any other method) is used on a clojurescript string object when using :optimizarions :advanced code does not work
This is a minimal project HelloWorld (I am attaching a full project "minimal.tgz"):
(let [elem (.getElementById js/document "app")]
(set! (.-innerHTML elem) (str "Hello World " (.. "Hello" (startsWith "H")))))
Will run fine with no optimizarions but when using :advanced I get: Uncaught TypeError: "Hello".Lb is not a function
I think that the issue is that Closure compiler may not be including ES2015 externs yet. `.startsWith` has been added to String prototype in ES2015. So I would have imagined that if the extern was provided, it shouldn't have mangled the function name.
This is not a bug. That's how Closure advanced optimization works. Use goog.string/startsWith instead.