I'm quite new to JS. I've been developing a couple of JS function. They work in Chrome. Yesterday I tried it in Safari and it's spitting out errors.
The function:
Request.SetForm = function (form, ruleset = [], messageset = null, focus = null, special = false, ignore = false) {
// Code here
}
I'm calling it like:
var $validator = Request.SetForm(arguments here);
Now Safari says:
ReferenceError: Can't find variable: Request
Well as I said, Chrome doesn't say anything and it works fine. What's wrong here?
Don't forget to declare the Request before using. use
var Request = {};
Then use
Request.method = function(){}
Because some older versions can't resolve a variable if not declared ( Normally the issue happen when we use in use strict
mode.
Or else, Request may be a keyword or built in method in the version of safari you are using. So just change the name.