From 01b0e12ba27b5069248fd09235e9a7143915ee30 Mon Sep 17 00:00:00 2001 From: Irvin Date: Wed, 16 Feb 2022 02:02:49 +0800 Subject: remove `notranslate` class in zh-CN --- .../reference/global_objects/string/includes/index.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'files/zh-cn/web/javascript/reference/global_objects/string/includes') diff --git a/files/zh-cn/web/javascript/reference/global_objects/string/includes/index.html b/files/zh-cn/web/javascript/reference/global_objects/string/includes/index.html index 83ced4b38a..672a34166f 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/string/includes/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/string/includes/index.html @@ -16,7 +16,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/String/includes

语法

-
str.includes(searchString[, position])
+
str.includes(searchString[, position])

参数

@@ -39,13 +39,13 @@ translation_of: Web/JavaScript/Reference/Global_Objects/String/includes

includes() 方法是区分大小写的。例如,下面的表达式会返回 false

-
'Blue Whale'.includes('blue'); // returns false
+
'Blue Whale'.includes('blue'); // returns false

兼容补丁

这个方法已经被加入到 ECMAScript 6 标准中,但未必在所有的 JavaScript 实现中都可以使用。然而,你可以轻松地 polyfill 这个方法:

-
if (!String.prototype.includes) {
+
if (!String.prototype.includes) {
   String.prototype.includes = function(search, start) {
     'use strict';
     if (typeof start !== 'number') {
@@ -64,7 +64,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/String/includes
 
 

使用 includes()

-
var str = 'To be, or not to be, that is the question.';
+
var str = 'To be, or not to be, that is the question.';
 
 console.log(str.includes('To be'));       // true
 console.log(str.includes('question'));    // true
-- 
cgit v1.2.3-54-g00ecf