简体   繁体   中英

Typescript including types and optional arguments

Write a JavaScript program to list the properties of a JavaScript object Sample object :

var student = { 
name : "David Rayy", 
sclass : "VI", 
rollno : 12 };

The question is to add typing, optional and default arguments in this program using Typescript.

including types and optional arguments

Types and optional members . Just an example:

var student: {name: string, sclass: string, rollno: number, somethingElse?: number} = { 
name : "David Rayy", 
sclass : "VI", 
rollno : 12 };

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM