鱼C论坛

 找回密码
 立即注册
查看: 3237|回复: 13

[庖丁解牛] 0 0 0 6 ★ 弄啥嘞“变量类型”这么弱智

[复制链接]
发表于 2017-3-31 20:42:16 | 显示全部楼层 |阅读模式
购买主题 已有 13 人购买  本主题需向作者支付 2 鱼币 才能浏览

本帖被以下淘专辑推荐:

想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2017-5-5 10:25:15 | 显示全部楼层
本帖最后由 shishunfu 于 2017-5-5 10:36 编辑
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4.         <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5.         <title>进击的巨人--JS</title>
  6.         <script>
  7.         alert(typeof x);
  8.         alert(x);
  9.         x="我爱鱼C";
  10.         alert(typeof x);
  11.         alert(x);
  12.         var x=33;
  13.         alert(typeof x);
  14.         alert(x);
  15.         x=true;
  16.         alert(typeof x);
  17.         alert(x);
  18.         x=[11,22,33];
  19.         alert(typeof x);
  20.         alert(x);
  21.         x=null;
  22.         alert(typeof x);
  23.         alert(x);
  24.         </script>
  25. </head>
  26. <body>
  27. </body>
  28. </html>
复制代码

点评

我很赞同!: 5.0
我很赞同!: 5
  发表于 2017-5-5 20:30
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2017-7-10 15:08:43 | 显示全部楼层
交!作!业!

  1. <!doctype html>
  2. <html>
  3.         <head>
  4.                 <meta http-equiv='Content-Type' content='text/html' charset='utf-8'>
  5.                 <title>第一个Js程序</title>
  6.                 <script type='text/javascript'>
  7.                         alert(typeof x);
  8.                         var x = 30;
  9.                         x = 'http';
  10.                         alert(typeof x);
  11.                         x = null;
  12.                         alert(typeof x);
  13.                         x = 5;
  14.                         alert(typeof x);
  15.                         x = [1,2,3];
  16.                         alert(typeof x);
  17.                 </script>
  18.         </head>
  19.         <body>
  20.         </body>
  21. </html>
复制代码

点评

我很赞同!: 5.0
我很赞同!: 5
  发表于 2017-7-10 15:16

评分

参与人数 1鱼币 +5 收起 理由
不二如是 + 5 热爱鱼C^_^

查看全部评分

想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2017-8-8 15:29:34 | 显示全部楼层
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>无标题文档</title>
  6. </head>
  7. <title>鱼c工作室-Js的变量类型</title>
  8.         <script type="text/javascript">
  9.                 var x=33;
  10.                         alert(x);
  11.                         alert(typeof x);
  12.                     x='i love fishc';
  13.                         alert(x);
  14.                     alert(typeof x);
  15.                 var y;
  16.                         alert(y);
  17.                         alert(typeof y)
  18.                
  19.                 var a=[0,'a',null];
  20.                         alert(a);
  21.                         alert(typeof a);
  22.                 var z=null;
  23.                         alert(z);
  24.                         alert(typeof z);
  25.         </script>
  26. <body>

  27. </body>
  28. </html>
复制代码


但是var a=[0,'a',null]这个里面好像不可以加null
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2017-11-14 15:31:04 | 显示全部楼层
在效果图正面的那行:Js代码中,alert()可以弹出提示信息框,而内部是(type x)。
有打字错误,(type x)应该是(typeof x)@不二如是

点评

我很赞同!: 5.0
我很赞同!: 5
谢谢指正~  发表于 2018-2-22 14:47

评分

参与人数 1荣誉 +5 鱼币 +5 收起 理由
不二如是 + 5 + 5 谢谢~

查看全部评分

想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2018-2-22 14:30:52 | 显示全部楼层
alret就是Python中的print,typeof就是Python中的type

点评

我很赞同!: 5.0
我很赞同!: 5
棒~  发表于 2018-2-22 14:34
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2018-6-21 13:49:04 | 显示全部楼层
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2019-9-30 16:19:39 | 显示全部楼层
~~打卡
1569831502(1).png
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2019-11-8 21:01:48 | 显示全部楼层
本帖最后由 你在意在便在 于 2019-11-8 21:04 编辑

   alert 是弹窗 。 typeof x 是为了显示它的数据类型~~
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4.     <meta charset="UTF-8">
  5.     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6.     <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7.     <meta http-equiv="X-UA-Compatible" content="ie=edge">
  8.     <title>Document</title>
  9. </head>
  10. <body>
  11.     <script>
  12.     var x=33;         // 数字
  13.         alert(typeof x);
  14.         x="我爱鱼C";  // 字符串
  15.         alert(typeof x);
  16.         x=true;      //  boolean值
  17.         alert(typeof x);
  18.         x=[1,2,3];   //  数组
  19.         alert(typeof x);
  20.     </script>
  21. </body>
  22. </html>
复制代码
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2021-9-3 17:58:43 | 显示全部楼层
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-4-24 18:19

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表