期刊文献+

在JavaScript中模拟“类”的方法探讨

Discussion on the Methods of Simulating “Class” in JavaScript
下载PDF
导出
摘要 随着JavaScript语言的应用越来越广泛,它的代码也变得越来越复杂,面向对象编程就成了必然的选择。然而JavaScript语言中没有"类"(class)的概念,这就给程序设计造成了不便。对用JavaScript语句模拟"类"的方法进行了研究,主要针对使用构造函数的方法和使用对象字面量(object literal)的方法,对二者的语法结构和实现效果进行了分析和比较,找到了最佳的方案。 With the JavaScript language is applied more and more widely, its code has become more and more complex,the object oriented programming became inevitable option.However,JavaScript does not have a concept of "class",which bring inconvenience to the program design.This paper has studied the methods of Using JavaScript code to simulate the "class",mainly for the methods of using constructor and using object literal,analyzed and compared the grammatical structure and the final results.Finally,the best solution has been found.
作者 周剑强
出处 《电脑开发与应用》 2012年第12期58-60,共3页 Computer Development & Applications
关键词 构造函数 对象字面量 class constructor object literal
  • 相关文献

参考文献4

  • 1Gabor de Mooij.Object oriented programming inJavascript[EB/OL].http://www.gabord emooij.com/articles/jsoop.html,2012-03-01.
  • 2Stoyan Stefanov.Object-Oriented JavaScript[M].Birmingham:Packt Publishing,2008.
  • 3Nicholos C Zakas.JavaScript高级程序设计[M].北京:人民邮电出版社,2006.
  • 4张大富,黄中敏.JavaScript动态网页编程实例手册[M].北京:海洋出版社,2005.

共引文献1

相关作者

内容加载中请稍等...

相关机构

内容加载中请稍等...

相关主题

内容加载中请稍等...

浏览历史

内容加载中请稍等...
;
使用帮助 返回顶部