Blogger Information
Blog 18
fans 0
comment 0
visits 14914
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
js 作业1
牛粪也香的博客
Original
632 people have browsed it

JS变量定义:

var name=111;

var name="abcd";

表达式:

var age=22;

if( age>10 /*表达示*/ ){

alert("you are ok");

}else{

alert("I'm sorry,you'd best back home!");

}

引用:

<script src="xxxx.js"> </script> //在xxx.js 里面,一定不能有<script></script>标签


变量数据类型:

var name="xxx";

var obj =new Object();

var arr=[1,3,4,6,9];

查看类型: alert(typeof(name));

整型、字符串、bool、对象、数组、...

函数:

alert("弹出相关的提示框"); 点了确定后才能继续

console.log(name);可以看更详细的信息

定义函数:

function func_name(){

   var num1=100;

   var num2=200;

   var sum=num1+num2;

  return sum;

}

var res= func_name();

alert(res);

传参数:

function func_name(num1,num2){

  // var num1=100;

   //var num2=200;

   var sum=num1+num2;

  return sum;

}

var res= func_name(500,600);

alert(res);

func_name(800.766);

function func_name(num1,num2){

  // var num1=100;

   //var num2=200;

   var sum=num1+num2();

func_name(500,function(){return 300;}) //这里的匿名函数,就相当于一个参数,变相的就是一个指针,只要返回结果是一个值就OK;

 num1+num2();//这里在调用num2时要以函数的形式。

TYFBM2}QJ}_$3JS[LH_D[$8.png

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