Created
May 31, 2025 17:12
-
-
Save davidystephenson/1b5089cadb8f1c6a4f7c781d607fb756 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const x = 'hello!!!' | |
console.log(x) | |
const y = 42 | |
type List = [first: string, second: string, third: number] | |
const list: List = ['a', 'b', 3] | |
function describe <T> (value?: T) { | |
console.log('The value is:', value) | |
} | |
describe() | |
describe() | |
function square (x: number) { | |
return x * x | |
} | |
interface Car { | |
model: string | |
distance: number | |
speed: number | |
licenseHistory: List | |
} | |
const car: Car = { | |
model: 'Prius', | |
distance: 100, | |
speed: 50, | |
licenseHistory: ['a', 'b', 1] | |
} | |
class Airplane { | |
engineCount: number | |
maker: string | |
constructor (engineCount: number, maker: string) { | |
this.engineCount = engineCount | |
this.maker = maker | |
} | |
} | |
console.log(Airplane) | |
const airplane = new Airplane(2, 'Cessna') // Object | |
console.log(airplane.engineCount) | |
const squaredEngineCount = square(airplane.engineCount) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment