最新文章专题视频专题问答1问答10问答100问答1000问答2000关键字专题1关键字专题50关键字专题500关键字专题1500TAG最新视频文章推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37视频文章20视频文章30视频文章40视频文章50视频文章60 视频文章70视频文章80视频文章90视频文章100视频文章120视频文章140 视频2关键字专题关键字专题tag2tag3文章专题文章专题2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章专题3
当前位置: 首页 - 科技 - 知识百科 - 正文

JavaScript学习小结

来源:动视网 责编:小采 时间:2020-11-27 20:30:40
文档

JavaScript学习小结

JavaScript学习小结:学习目的:1.Web相关开发越来越流行,学习JS十分有必要2.多学习一种语言,想多了解一种语言的文化内涵3.认识一下脚本语言,之前一直学习C,C++,换换口味 学习途径:1.之前实习期间的项目积累2.互联网的各种零碎的资料3.codecademy的在线Js教学课程(冗
推荐度:
导读JavaScript学习小结:学习目的:1.Web相关开发越来越流行,学习JS十分有必要2.多学习一种语言,想多了解一种语言的文化内涵3.认识一下脚本语言,之前一直学习C,C++,换换口味 学习途径:1.之前实习期间的项目积累2.互联网的各种零碎的资料3.codecademy的在线Js教学课程(冗


学习目的:
1.Web相关开发越来越流行,学习JS十分有必要

2.多学习一种语言,想多了解一种语言的文化内涵

3.认识一下脚本语言,之前一直学习C,C++,换换口味


学习途径:
1.之前实习期间的项目积累

2.互联网的各种零碎的资料

3.codecademy的在线Js教学课程(冗长细致的课程,打字打到手抽筋)

4.各种书本,如《headfirst Js》等


零星的感受:

1.js中类的属性,可以使用.也可以使用["xx"]来标识


2.JS也有封装,在类的构造函数中使用 var来定义属性或者方法而不是this


3.Js的函数定义之后没有分好,但是变量定义之后有分号。


4.函数和类中的this不能省略


5.Js的实例化是通过 new 构造函数实现的。

function Person(name,age) {

[javascript]
this.name = name;
this.age = age;
}
// Let's make bob and susan again, using our constructor
var bob = new Person("Bob Smith", 30);

this.name = name;
this.age = age;
}
// Let's make bob and susan again, using our constructor
var bob = new Person("Bob Smith", 30);6.使用prototype使得每个实例都有这个属性,也实现了继承
[javascript]
// the original Animal class and sayName method
function Animal(name, numLegs) {
this.name = name;
this.numLegs = numLegs;
}
Animal.prototype.sayName = function() {
console.log("Hi my name is "+this.name);
};

// define a Penguin class
function Penguin(name, numLegs) {
this.name = name;
this.numLegs = 2;
}

// set its prototype to be a new instance of Animal
Penguin.prototype = new Animal();

var penguin = new Penguin("Gigi");
penguin.sayName();

// the original Animal class and sayName method
function Animal(name, numLegs) {
this.name = name;
this.numLegs = numLegs;
}
Animal.prototype.sayName = function() {
console.log("Hi my name is "+this.name);
};

// define a Penguin class
function Penguin(name, numLegs) {
this.name = name;
this.numLegs = 2;
}

// set its prototype to be a new instance of Animal
Penguin.prototype = new Animal();

var penguin = new Penguin("Gigi");
penguin.sayName();

文档

JavaScript学习小结

JavaScript学习小结:学习目的:1.Web相关开发越来越流行,学习JS十分有必要2.多学习一种语言,想多了解一种语言的文化内涵3.认识一下脚本语言,之前一直学习C,C++,换换口味 学习途径:1.之前实习期间的项目积累2.互联网的各种零碎的资料3.codecademy的在线Js教学课程(冗
推荐度:
  • 热门焦点

最新推荐

猜你喜欢

热门推荐

专题
Top