This article analyzes Javascript string browser compatibility issues with examples. Share it with everyone for your reference. The specific analysis is as follows:
Let’s first look at the incompatible writing methods. If I want to get the number of a string
var str='aavvvcc';
console.info(str[0]);
This way of writing is not compatible with browsers below IE 7. The following provides a method that is fully compatible with browsers
var str='aavvvcc';
console.info(str.charAt(1));
Use charAt() to get a certain character in a string, and all are compatible.
I hope this article will be helpful to everyone’s JavaScript programming design.
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn