Dhananjay Patel Logo
  1. Home
  2. / Blog
  3. / Typescript Basic
  4. / Lessons
  5. / 3
index.ts
let userName: string = "Dhananjay Patel"
let nyNumber: number = 10
let isLoggedIn: boolean = true
let myRegex: RegExp = /test/
const namesPart: string[] = userName.split(" ")
// const namesPart: Array<string> = userName.split(" ")
const myValues: number[] = [1,2,4]
// const myValues: Array<number> = [1,2,4]
const person: {
firstName: string;
lastName: string;
} = {
firstName: "Dhananjay",
lastName: "Patel"
}
// interface Person {
// firstName: string;
// lastName: string;
// }
// const person: Person = {
// firstName: "Dhananjay",
// lastName: "Patel"
// }
// type Person = {
// firstName: string;
// lastName: string;
// }
// const person: Person = {
// firstName: "Dhananjay",
// lastName: "Patel"
// }
const romanNumber: Record<number, string> = {
1: 'I',
5: 'V',
9: 'IX'
}

Tip: To see the types suggesation by vscode, place your cursor above variable and click CTRL+K+I