jsdocexample.js

来自「买书附带的光盘资料Foundations_Of_Ajax中文版教程及源代码。 」· JavaScript 代码 · 共 71 行

JS
71
字号
/**  * @fileoverview This file is an example of how JSDoc can be used to document * JavaScript.  * * @author Ryan Asleson * @version 1.0  *//** * Construct a new Person class. * @class This class represents an instance of a Person. * @constructor  * @param {String} name The name of the Person. * @return A new instance of a Person.*/function Person(name) {    /**      * The Person's name     * @type String    */    this.name = name;    /**     * Return the Person's name. This function is assigned in the class     * constructor rather than using the prototype keyword.     * @returns The Person's name     * @type String     */    this.getName = function() {        return name;    }}/** * Construct a new Employee class. * @extends Person * @class This class represents an instance of an Employee. * @constructor  * @return A new instance of a Person.*/function Employee(name, title, salary) {    this.name = name;    /**      * The Employee's title     * @type String    */    this.title = title;    /**      * The Employee's salary     * @type int    */    this.salary = salary;}/* Employee extends Person */Employee.prototype = new Person();/** * An example of function assignment using the prototype keyword.  * This method returns a String representation of the Employee's data. * @returns The Employee's name, title, and salary  * @type String*/Employee.prototype.getDescription = function() {    return this.name + " - "         + this.title + " - "        + "$" + this.salary;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?