<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>进击的巨人--JS</title>
<script>
alert(typeof x);
alert(x);
x="我爱鱼C";
alert(typeof x);
alert(x);
var x=33;
alert(typeof x);
alert(x);
x=true;
alert(typeof x);
alert(x);
x=;
alert(typeof x);
alert(x);
x=null;
alert(typeof x);
alert(x);
</script>
</head>
<body>
</body>
</html> 交!作!业!
<!doctype html>
<html>
<head>
<meta http-equiv='Content-Type' content='text/html' charset='utf-8'>
<title>第一个Js程序</title>
<script type='text/javascript'>
alert(typeof x);
var x = 30;
x = 'http';
alert(typeof x);
x = null;
alert(typeof x);
x = 5;
alert(typeof x);
x = ;
alert(typeof x);
</script>
</head>
<body>
</body>
</html> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<title>鱼c工作室-Js的变量类型</title>
<script type="text/javascript">
var x=33;
alert(x);
alert(typeof x);
x='i love fishc';
alert(x);
alert(typeof x);
var y;
alert(y);
alert(typeof y)
var a=;
alert(a);
alert(typeof a);
var z=null;
alert(z);
alert(typeof z);
</script>
<body>
</body>
</html>
但是var a=这个里面好像不可以加null 在效果图正面的那行:Js代码中,alert()可以弹出提示信息框,而内部是(type x)。
有打字错误,(type x)应该是(typeof x)@不二如是 alret就是Python中的print,typeof就是Python中的type {:5_91:} ~~打卡 本帖最后由 你在意在便在 于 2019-11-8 21:04 编辑
{:10_256:} alert 是弹窗 。 typeof x 是为了显示它的数据类型~~
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<script>
var x=33; // 数字
alert(typeof x);
x="我爱鱼C";// 字符串
alert(typeof x);
x=true; //boolean值
alert(typeof x);
x=; //数组
alert(typeof x);
</script>
</body>
</html> {:7_146:} 学习了{:10_333:}
页:
[1]