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中的示例相关推荐

  1. eval 函数 代替函数_eval()函数以及JavaScript中的示例

    eval 函数 代替函数 eval()函数 (eval() function) eval() function is a predefined global function in JavaScrip ...

  2. 用JavaScript中的示例进行fill()函数

    fill() is a predefined function in JavaScript, which is used to fill all elements of an array with a ...

  3. to_number用法示例_Number()函数以及JavaScript中的示例

    to_number用法示例 Number()函数 (Number() function) Number() function is a predefined global function in Ja ...

  4. 使用JavaScript中的示例的escape()函数

    While transferring the data over the network or sometimes while saving data to the database, we need ...

  5. java中isnan函数_isNaN()函数以及JavaScript中的示例

    java中isnan函数 Prerequisite: NaN property in JavaScript 先决条件: JavaScript中的NaN属性 isNaN()函数 (isNaN() fun ...

  6. java函数参数使用冒号_java8中:: 用法示例(JDK8双冒号用法)

    JDK8中有双冒号的用法,就是把方法当做参数传到stream内部,使stream的每个元素都传入到该方法里面执行一下. 代码其实很简单: 以前的代码一般是如此的: public class Accep ...

  7. JavaScript中带有示例的Math.log10()方法

    JavaScript | Math.log10()方法 (JavaScript | Math.log10() Method) Math operations in JavaScript are han ...

  8. JavaScript中带有示例的Math.abs()方法

    JavaScript | Math.abs()方法 (JavaScript | Math.abs() Method) Math operations in JavaScript are handled ...

  9. 使用JavaScript中的示例编号MAX_VALUE属性

    数字MAX_VALUE属性 (Number MAX_VALUE Property) MAX_VALUE Property is a Number property in JavaScript and ...

最新文章

  1. 在echarts中自定义提示框内容
  2. 构造函数中的虚拟成员调用
  3. oracle 11g函数包缓存,Oracle11新特性——PLSQL函数缓存结果(一)
  4. div没有设置高度,背景颜色却无法显示
  5. java集合框架总结(一)
  6. bytearrayinputstream java_java io系列02之 ByteArrayInputStream的简介,源码分析和示例(包括InputStream)...
  7. win服务器自动发邮件,asp.net基于windows服务实现定时发送邮件的方法
  8. access mysql 同步,SQLServer2008 同步Access数据库
  9. jquery_ajax_js,浅析jQuery Ajax通用js封装
  10. 数据清洗的主要类型及步骤
  11. 使用360安全卫士对计算机进行体检,360安全卫士使用教程 电脑体检
  12. poj1265 -- Area(皮克定理)
  13. C#wmp.dll自动注册失败
  14. php 手机号码所属城市,基于PHP的手机号码归属地查询
  15. 翡翠玉石微观世界,太美了!
  16. 详细了解 Linkerd 2.10 基础功能,一起步入 Service Mesh 微服务架构时代
  17. git拉取代码报错fatal Authentication failed for ‘httpxxxx.git‘‘解决方案
  18. 数据库系统-关系模式
  19. 笔记本计算机作文,介绍笔记本电脑的作文600字
  20. 复旦微ZYNQ 四核使用

热门文章

  1. 设置springboot日志级别_Spring Boot 日志框架实践
  2. thinkPHP利用ajax异步上传图片并显示、删除
  3. HTML5教程之-文件拖拽功能实现
  4. CSS基础知识(display和visibility、overflow、文档流)
  5. vue 后端返回二进制流文件,前端如何实现下载?
  6. Git初始化配置以及配置github
  7. 洛谷 P1018乘积最大
  8. Remmarguts' Date(POJ2449+最短路+A*算法)
  9. 洛谷-P1160 队列安排
  10. iPhone UITableViewCell如何滚动到视图顶端。