不理解,如果有高手看到了,请帮忙解答,谢谢啦~

例1:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
</head>
<body>

<p> constructor 属性返回变量或对象的构造函数。</p>
<p id="demo"></p>
<script>
var a=[1,2,3,4];
document.getElementById("demo").innerHTML =
"john".constructor + "<br>" +
(3.14).constructor + "<br>" +
false.constructor + "<br>" +
"b".constructor+"<br>"+
a.constructor + "<br>" +
typeof a.constructor + "<br>" +
a.constructor.toString()+"<br>"+
typeof a.constructor.toString()+"<br>"+
a.constructor.toString().indexOf("Array")+"<br>"+
typeof a.constructor.toString().indexOf("Array")+"<br>"+
//a.constructor.toString().indexOf("Array") > -1+"<br>"+
//typeof a.constructor.toString().indexOf("Array") > -1+"<br>"+
{name:‘john‘, age:34}.constructor + "<br>" +
new Date().constructor + "<br>" +
function () {}.constructor;
</script>

</body>
</html>

例1结果:
constructor 属性返回变量或对象的构造函数。

function String() { [native code] }
function Number() { [native code] }
function Boolean() { [native code] }
function String() { [native code] }
function Array() { [native code] }
function
function Array() { [native code] }
string
9
number
function Object() { [native code] }
function Date() { [native code] }
function Function() { [native code] }

例2:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
</head>
<body>

<p> constructor 属性返回变量或对象的构造函数。</p>
<p id="demo"></p>
<script>
var a=[1,2,3,4];
document.getElementById("demo").innerHTML =
"john".constructor + "<br>" +
(3.14).constructor + "<br>" +
false.constructor + "<br>" +
"b".constructor+"<br>"+
a.constructor + "<br>" +
typeof a.constructor + "<br>" +
a.constructor.toString()+"<br>"+
typeof a.constructor.toString()+"<br>"+
a.constructor.toString().indexOf("Array")+"<br>"+
typeof a.constructor.toString().indexOf("Array")+"<br>"+
a.constructor.toString().indexOf("Array") > -1+"<br>"+
//typeof a.constructor.toString().indexOf("Array") > -1+"<br>"+
{name:‘john‘, age:34}.constructor + "<br>" +
new Date().constructor + "<br>" +
function () {}.constructor;
</script>

</body>
</html>

例2 结果:
constructor 属性返回变量或对象的构造函数。

true

例3:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
</head>
<body>

<p> constructor 属性返回变量或对象的构造函数。</p>
<p id="demo"></p>
<script>
var a=[1,2,3,4];
document.getElementById("demo").innerHTML =
"john".constructor + "<br>" +
(3.14).constructor + "<br>" +
false.constructor + "<br>" +
"b".constructor+"<br>"+
a.constructor + "<br>" +
typeof a.constructor + "<br>" +
a.constructor.toString()+"<br>"+
typeof a.constructor.toString()+"<br>"+
a.constructor.toString().indexOf("Array")+"<br>"+
typeof a.constructor.toString().indexOf("Array")+"<br>"+
a.constructor.toString().indexOf("Array") > -1+"<br>"+
typeof a.constructor.toString().indexOf("Array") > -1+"<br>"+
{name:‘john‘, age:34}.constructor + "<br>" +
new Date().constructor + "<br>" +
function () {}.constructor;
</script>

</body>
</html>

例3结果:
constructor 属性返回变量或对象的构造函数。

false

例4:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
</head>
<body>

<p> constructor 属性返回变量或对象的构造函数。</p>
<p id="demo"></p>
<script>
var a=[1,2,3,4];
document.getElementById("demo").innerHTML =
"john".constructor + "<br>" +
(3.14).constructor + "<br>" +
false.constructor + "<br>" +
"b".constructor+"<br>"+
a.constructor + "<br>" +
typeof a.constructor + "<br>" +
a.constructor.toString()+"<br>"+
typeof a.constructor.toString()+"<br>"+
a.constructor.toString().indexOf("Array")+"<br>"+
typeof a.constructor.toString().indexOf("Array")+"<br>"+
//a.constructor.toString().indexOf("Array") > -1+"<br>"+
typeof a.constructor.toString().indexOf("Array") > -1+"<br>"+
{name:‘john‘, age:34}.constructor + "<br>" +
new Date().constructor + "<br>" +
function () {}.constructor;
</script>

</body>
</html>

例4结果:
constructor 属性返回变量或对象的构造函数。

true

例5:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
</head>
<body>

<p> constructor 属性返回变量或对象的构造函数。</p>
<p id="demo"></p>
<script>
var a=[1,2,3,4];
document.getElementById("demo").innerHTML =
"john".constructor + "<br>" +
(3.14).constructor + "<br>" +
false.constructor + "<br>" +
"b".constructor+"<br>"+
a.constructor + "<br>" +
typeof a.constructor + "<br>" +
a.constructor.toString()+"<br>"+
typeof a.constructor.toString()+"<br>"+
a.constructor.toString().indexOf("Array")+"<br>"+
typeof a.constructor.toString().indexOf("Array")+"<br>"+
a.constructor.toString().indexOf("Array") > -1+"<br>"+
{name:‘john‘, age:34}.constructor + "<br>" +
new Date().constructor + "<br>" +
function () {}.constructor+"<br>"+
typeof a.constructor.toString().indexOf("Array") > -1;
</script>

</body>
</html>

例5结果:
constructor 属性返回变量或对象的构造函数。

true

例6:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
</head>
<body>

<p> constructor 属性返回变量或对象的构造函数。</p>
<p id="demo"></p>
<script>
var a=[1,2,3,4];
document.getElementById("demo").innerHTML =
typeof a.constructor.toString().indexOf("Array") > -1+"<br>"+;
"john".constructor + "<br>" +
(3.14).constructor + "<br>" +
false.constructor + "<br>" +
"b".constructor+"<br>"+
a.constructor + "<br>" +
typeof a.constructor + "<br>" +
a.constructor.toString()+"<br>"+
typeof a.constructor.toString()+"<br>"+
a.constructor.toString().indexOf("Array")+"<br>"+
typeof a.constructor.toString().indexOf("Array")+"<br>"+
a.constructor.toString().indexOf("Array") > -1+"<br>"+
{name:‘john‘, age:34}.constructor + "<br>" +
new Date().constructor + "<br>" +
function () {}.constructor;
</script>

</body>
</html>

例6结果:
constructor 属性返回变量或对象的构造函数。

例7:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
</head>
<body>

<p> constructor 属性返回变量或对象的构造函数。</p>
<p id="demo"></p>
<script>
var a=[1,2,3,4];
document.getElementById("demo").innerHTML =
typeof a.constructor.toString().indexOf("Array") > -1+"<br>"+
"john".constructor + "<br>" +
(3.14).constructor + "<br>" +
false.constructor + "<br>" +
"b".constructor+"<br>"+
a.constructor + "<br>" +
typeof a.constructor + "<br>" +
a.constructor.toString()+"<br>"+
typeof a.constructor.toString()+"<br>"+
a.constructor.toString().indexOf("Array")+"<br>"+
typeof a.constructor.toString().indexOf("Array")+"<br>"+
a.constructor.toString().indexOf("Array") > -1+"<br>"+
{name:‘john‘, age:34}.constructor + "<br>" +
new Date().constructor + "<br>" +
function () {}.constructor;
</script>

</body>
</html>

例7结果:
constructor 属性返回变量或对象的构造函数。

false

例8:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
</head>
<body>

<p> constructor 属性返回变量或对象的构造函数。</p>
<p id="demo"></p>
<script>
var a=[1,2,3,4];
document.getElementById("demo").innerHTML =
typeof a.constructor.toString().indexOf("Array") > -1+"<br>"+
"john".constructor + "<br>" +
(3.14).constructor + "<br>" +
false.constructor + "<br>" +
"b".constructor+"<br>"+
a.constructor + "<br>" +
typeof a.constructor + "<br>" +
a.constructor.toString()+"<br>"+
typeof a.constructor.toString()+"<br>"+
a.constructor.toString().indexOf("Array")+"<br>"+
typeof a.constructor.toString().indexOf("Array")+"<br>"+
//a.constructor.toString().indexOf("Array") > -1+"<br>"+
{name:‘john‘, age:34}.constructor + "<br>" +
new Date().constructor + "<br>" +
function () {}.constructor;
</script>

</body>
</html>

例8结果:
constructor 属性返回变量或对象的构造函数。

true

问题:(typeof a.constructor.toString().indexOf("Array")) > -1 的摆放位置决定了最后的结果,该句只有放在最后的时候,输出才是true,其它位置都是false,为什么?

时间: 2024-08-02 13:40:36

不理解,如果有高手看到了,请帮忙解答,谢谢啦~的相关文章

好朋友的小姨,希望一起帮助下度过难关,方便的话请帮忙转发一下,谢谢。————————心情记录

好朋友的小姨,希望一起帮助下度过难关,方便的话请帮忙转发一下,谢谢. https://ssl.gongyi.qq.com/m/weixin/ws_detail.html?from=timeline#pid=E80BFC9CDF13A1143B0B80C164ED4C27&share=yes 之前身边的几个亲戚,似乎知道的时候是已离去了,现在的这是时候似乎却更让我揪心,似乎爸妈以i西安也并不怎么轻松,似乎GM,GF,B的离去并没有太难过,只是当时心情比较压抑,现在聚少离多,还是珍惜现在有的机会吧.

十万火急,还请各位园友们帮帮忙。谢谢!!能够用Java写出来的麻烦发一下代码。

一辆大众车时速60km/时,以每小时5km速度加速,这辆车最大时速为120km/时: 一辆宝马车时速70km/时,以每小时8km速度加速,这辆车最大时速为150km/时:请问这两辆车分别多久能行驶1000km??? 请用Java编写出来,,,十万火急.帮帮忙,谢谢. 原文地址:https://www.cnblogs.com/x10011314xxx/p/11125454.html

如何把代码写的清晰,易理解。求高手分享写代码经验。

程序代码: #include <stdio.h>#include <stdlib.h>#include <string.h>#define _STDC_WANT_LIB_EXT1_ 1#define buffer_len 10#define buffer_len_inc 5#define string_cont 5#define string_cont_inc 2 int main(void){ int test_int = 0;        int buf_len

Oracle Update TOP N Issue, 请专家解答

大家好 上周写了匿名方法一文,很多读者,很高兴,相信我们已经从大伙的回复中,对.NET又有了更深刻的认识. 好,现在说主题,各类数据库都有相应更新本表top n的方案.现在我一一举例 首先看表结构如下: 数据库以及表创建命令初始化数据库语句 1 CREATE TABLE student( 2 id varchar(256) NOT NULL, 3 name varchar(256) NULL, 4 age int NULL) 1 insert into student values('001',

用hexo + github 快速搭建个人博客,由于刚搭建好,有点小激动,就分享下,不好的地方还请指出,谢谢

1.先创建自己的项目目录,项目名字就是:你的username.github.io,因为我创建了所以他警告了我,说已经重复了,然后就点Create 附上官网的解说文档:https://pages.github.com/ 安装里面的,快速建立后把代码clone 下来. 3.按装hexo ,前提你要先安装 node ,然后再安装git for windows 4.打开git shell 然后安装hexo npm install hexo-cli -g(全局安装) npm install hexo --

请帮忙用android的XmlPullParser解析xml中的节点

============问题描述============ 怎么解析Version和COMPANY的值? <TASKREPLY> <MESSAGE Type="0" > <DATA Version="1"  COMPANY="2"/> </MESSAGE> </TASKREPLY> ============解决方案1============ XmlPullParser parser: St

DFS搜索入门(第一次写不完善的还请指出,谢谢大家支持)

题意:给定从1到n的n个数,这些数中有一些和其他数存在一种关系.给定所有关系,并给初值ans为1:将这n个数以一种顺序取出,(每当取出的数与之前已取出的数存在关系,ans值将翻倍.)最后使得ans值最大. 思路解析:本题中数字间关系可以在图中表示出来.列如n = 9:m = 9:(1,2): (1,4): (2,3): (2,4): (7,2):(4,7):(5,8):(5,6):(8,6): 这样就可以将数字间的关系用图清晰的表示出来,而任意一个连通图中的点的个数p决定ans值最大的翻倍次数为

不知道这是什么错误,什么原因造成,请大家帮忙解答

生产环境: 服务器操作系统 CentOS 6.8

高手帮忙看看谢谢

ug6izx良釉鸦头伦墓<http://weibo.com/p109p703p/230927983036789268680704> 1b1am1滥炮制辽粗痈<http://weibo.com/p20180414Pp/230927982730683350781952> 6t5u55卧程亓甭柯合<http://weibo.com/p756p045p/230927983084959763795968> abn3v9拇仄帽辉芽刈<http://weibo.com/qdyb