Reputation: 425
How do I add in a check in my code to make the parameter variable not case sensitive? I want a user to be able to type in ab=ac as a query parameter or AB=AC or aB=aC and any other variations. My code is below. Based on the parameter present, headOne or headTwo will show on the page.
myObject: function() {
var parameter = window.location.search.includes("ab=ac");
var headOne = data.headerOne;
var headTwo = data.headerTwo;
var helpers = _.extend(this.constructor.__super__.myObject.call(this), {
header: parameter ? headerOne : headerTwo
});
return helpers;
}
Upvotes: 1
Views: 66
Reputation: 167192
You can convert it to lowercase and compare:
var parameter = window.location.search.toLowerCase().includes("ab=ac");
//------------------------------------^^^^^^^^^^^^^^
Upvotes: 5