// @ts-check
/**
* To generate jsdoc documentattion based on configuration run the command `npm run doc`,
* which means document as mentioned as `scripts['doc']: "jsdoc -c jsdoc.json"` as set in package.json
* which in turn run as configured in `[source]["include"]: ["src"]` in jsdoc.json,
*/
/**
* To generate jsdoc documentattion w/o configuration, run the command
* `jsdoc path/to/my/file.js`
* with config
* `jsdoc path/to/my/file.js -c jsdoc.json`
* or
* `jsdoc path/to/my/folder`
* with config
* `jsdoc path/to/my/folder -c jsdoc.json`
*/
/**
* @file index.js is the root file for this example app. This line is shown in homepage of jsdco documentation because this is prefixed by `@file` tag
* @author Sreekanth Dayanand
* @see <a href="https://outsource-online.net">Outsource Online Internet Solutions</a>
*/
const {add,multiply} = require('./calculator');// same as import { add, multiply } from './calculator';
/**
* Student Name
* @author Sreekanth Dayanand
* @type {String}
*/
const studentName = "John Doe";
/**
* @type {Array<number>}
*/
let grades = [98,91,88];
/**
* @type {{id: number|string, text:string}}
*/
const todo ={
id: 1,
text:'Hello'
};
/**
* Calculate Tax
* @param {number} amount - Total amount
* @param {number} tax - Tax percentage
* * calculateTax(120,10);
* * calculateTax(220,15);
* @returns {string} - Total with a dollar sign
*/
const calculateTax = (amount, tax) => {
return `$${amount + tax * amount}`
}
/**
* To display output of below line run the command `node src`,
* which means run index.js folder src
*/
console.log(calculateTax(100, 0.5));
/**
* A student
* @typedef {Object} Student
* @property {number} id - Student ID
* @property {string} name - Student name
* @property {string|number} [age]] - Student age
* @property {boolean} isActive - Wether Student is active
*/
/**
* @type {Student}
*/
const student = {
id : 1,
name: "John Doe",
isActive:true
}
/**
* class to construct a person
*/
class Person{
/**
*
* @param {Object} personInfo Information about the person
*/
constructor(personInfo){
/**
* @property {string} name name of the person
*/
this.name = personInfo.name;
/**
* @property {string|number} age age of the person
*/
this.age = personInfo.age;
}
/**
* @property {function} greet A greeting with name and age
* @returns {void}
*/
greet(){
console.log(`Hello , my name is ${this.name} and i am ${this.age} years old`);
}
}
/**
* Person1
* see {@link Person}
*/
const person1 = new Person({
name: "john Doe",
age:20
});
person1.greet();