Blogger Information
Blog 16
fans 0
comment 0
visits 11424
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
JS的基础——变量的声明、数据类型及条件语句-2019年3月25日20时00分
多@点的博客
Original
677 people have browsed it

这周开始,我们对JavaScript进行了学习,今天是对JavaScript的基础学习,有变量的声明、数据类型及条件语句等,在有对它有一定了解的基础上,并能记住。下面是我练习的结果:

实例

<!DOCTYPE html>
<html>
<head>
	<title>JavaScript第一章(基础)</title>
	<link rel="icon" type="image/x-icon" href="static/images/favicon.ico">
	<script>
		document.write('你好')
	</script>

	<script type="text/javascript" src="static/all.js"></script>
	
</head>
<body>	
  <script type="text/javascript">
      var x=6;
      console.log(x);
      var y=6,z=11;
      console.log(z+y);

      var a;
      document.write(a);

      var b=1;
      var c="我是无忌哥哥!";
      var d=3;
      var name=['aaa','bbb','ccc','ddd'];

      var e={
      	name:'张无忌',
      	age:24,
      	weight:'60kg',
      	height:'175cm'
      }
    document.write('<hr>')

// 给学生的成绩划分等级
      var grade=95;
      if(grade>=90){
      	document.write('优秀!');
      }else if(grade>=80 && grade<90){
      	document.write('良好!');
      }else if(grade>=70 && grade<80){
      	document.write('良!');
      }else if(grade>=60 && grade<70){
      	document.write('及格!');
      }else{
      	document.write('不及格!');
      }

// 判断是否为闰年
      var years=2000;
      if(years%4==0 && years%4!==0){
      	alert('是闰年!');
      }else if(years%4==0 && years%100==0){
      	alert('是世纪闰年!');
      }else{
      	alert('不是闰年!');
      }

  </script>

</body>
</html>

运行实例 »

点击 "运行实例" 按钮查看在线实例

1.jpg

2.jpg

总结:JavaScript对于我们初学者来说,不知是能够记住它,还要对它有深入的理解,并能够运用到实际的案列中,这需要我们多加练习!


Correction status:qualified

Teacher's comments:加油!
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post