TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Nikunj Satasiya
183
10k
3.6m
JavaScript includes and indexOf not working in IE8
Mar 4 2021 6:38 AM
Hi Everyone,
I am working with one of the projects to make it compatible with IE8. I got this issue as I have shown below, will you please give me any alternate way or suggestion to use these functions in Javascript?
SCRIPT438: Object doesn't support property or method 'includes'
SCRIPT436: Object doesn't support property or method '
indexOf
'
I tried this
function
includes(container, value) {
var
returnValue =
false
;
var
pos = container.indexOf(value);
if
(pos >= 0) {
returnValue =
true
;
}
return
returnValue;
}
includes([1,2,3],2)
//=> true
includes([1,2,3],
'a'
)
//=> false
Also tryed
if
(!String.prototype.includes) {
//To check browser supports or not
String.prototype.includes =
function
(str) {
//If not supported, then define the method
return
this
.indexOf(str) !== -1;
}
}
but not work well for IE8.
Will anyone please help me.
Reply
Answers (
1
)
Is it possible to make the google marker on top of a label
attach file in outlook using mailto function