We declaring some variable with core data type.
let num:number = 10;
let str:string = "hello";
let isTrue:boolean = true;
We creating an object
type objType = {name:string,age:number,email:string};
const person:{name:string,age:number,email:string} = {
name:"krishna",
age:28,
email:'krishna@gmail.com'
}
const user:objType = {
name:"ganesh",
age:25,
email:'ganesh@gmail.com'
}
console.log(person.name)
We making own specific data type that is number data type.
let data:5 = 5;
We are printing array with different data type.
let arr:number[] = [32,6,23,879];
let arr2:string[] = ["java","php","node","python"];
let arr3:any[] = ["hello",123,true];
let arr4:[string,number,boolean] = ["hello",123,true];
let arr5 = ["hello",123,true];
arr2[2] = "angular";
arr2.push("Django");
console.log(arr);
We are printing data of number data type.
const num:number = 10;
console.log(num);