include函数_include()函数以及JavaScript中的示例
include函数
includes() is a predefined function in JavaScript, which is used to check whether a given element exists in the array or not?
include()是JavaScript中的预定义函数,用于检查数组中是否存在给定元素?
Example:
例:
<html>
<head>
<title>JavaScipt Example</title>
</head>
<body>
<script>
//array
var cities = ["New Delhi", "Mumbai", "Chennai", "Banglore"];
//checking whether "New Delhi" exists or not
if(cities.includes("New Delhi")==true)
document.write("New Delhi exists in the array");
else
document.write("New Delhi does not exist in the array");
document.write("<br>");
//checking whether "Pune" exists or not
if(cities.includes("Pune")==true)
document.write("Pune exists in the array");
else
document.write("Pune does not exist in the array");
document.write("<br>");
</script>
</body>
</html>
Output
输出量
New Delhi exists in the array
Pune does not exist in the array
翻译自: https://www.includehelp.com/code-snippets/includes-function-with-example-in-javascript.aspx
include函数
include函数_include()函数以及JavaScript中的示例相关推荐
- eval 函数 代替函数_eval()函数以及JavaScript中的示例
eval 函数 代替函数 eval()函数 (eval() function) eval() function is a predefined global function in JavaScrip ...
- 用JavaScript中的示例进行fill()函数
fill() is a predefined function in JavaScript, which is used to fill all elements of an array with a ...
- to_number用法示例_Number()函数以及JavaScript中的示例
to_number用法示例 Number()函数 (Number() function) Number() function is a predefined global function in Ja ...
- 使用JavaScript中的示例的escape()函数
While transferring the data over the network or sometimes while saving data to the database, we need ...
- java中isnan函数_isNaN()函数以及JavaScript中的示例
java中isnan函数 Prerequisite: NaN property in JavaScript 先决条件: JavaScript中的NaN属性 isNaN()函数 (isNaN() fun ...
- java函数参数使用冒号_java8中:: 用法示例(JDK8双冒号用法)
JDK8中有双冒号的用法,就是把方法当做参数传到stream内部,使stream的每个元素都传入到该方法里面执行一下. 代码其实很简单: 以前的代码一般是如此的: public class Accep ...
- JavaScript中带有示例的Math.log10()方法
JavaScript | Math.log10()方法 (JavaScript | Math.log10() Method) Math operations in JavaScript are han ...
- JavaScript中带有示例的Math.abs()方法
JavaScript | Math.abs()方法 (JavaScript | Math.abs() Method) Math operations in JavaScript are handled ...
- 使用JavaScript中的示例编号MAX_VALUE属性
数字MAX_VALUE属性 (Number MAX_VALUE Property) MAX_VALUE Property is a Number property in JavaScript and ...
最新文章
- 在echarts中自定义提示框内容
- 构造函数中的虚拟成员调用
- oracle 11g函数包缓存,Oracle11新特性——PLSQL函数缓存结果(一)
- div没有设置高度,背景颜色却无法显示
- java集合框架总结(一)
- bytearrayinputstream java_java io系列02之 ByteArrayInputStream的简介,源码分析和示例(包括InputStream)...
- win服务器自动发邮件,asp.net基于windows服务实现定时发送邮件的方法
- access mysql 同步,SQLServer2008 同步Access数据库
- jquery_ajax_js,浅析jQuery Ajax通用js封装
- 数据清洗的主要类型及步骤
- 使用360安全卫士对计算机进行体检,360安全卫士使用教程 电脑体检
- poj1265 -- Area(皮克定理)
- C#wmp.dll自动注册失败
- php 手机号码所属城市,基于PHP的手机号码归属地查询
- 翡翠玉石微观世界,太美了!
- 详细了解 Linkerd 2.10 基础功能,一起步入 Service Mesh 微服务架构时代
- git拉取代码报错fatal Authentication failed for ‘httpxxxx.git‘‘解决方案
- 数据库系统-关系模式
- 笔记本计算机作文,介绍笔记本电脑的作文600字
- 复旦微ZYNQ 四核使用