-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfirst2.mjs
More file actions
36 lines (21 loc) · 797 Bytes
/
Copy pathfirst2.mjs
File metadata and controls
36 lines (21 loc) · 797 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
//import & export-
import { someFunction } from './example.mjs';
someFunction();
import { add } from './example.mjs';
const result= add(9,10)
console.log(result);
//Classes-
import { Animal, Cat, Player, TennisPlayer } from './example.mjs'
let cat= new Animal('cat','orange');
let cat2= new Cat('cat','orange');
// console.log(cat.color);
// console.log(cat.makeNoise('meow'))
// console.log(Animal.return10()) //we don't have to intantiate any variable to assign to animal here since it is static
console.log(cat.metadata);
//DON'T USE METADATA() HERE SINCE IT IS NOT A FUNCTION
cat2.makeNoise();
console.log(cat2.metadata);
let player= new Player('Messi', 'Argentina');
player.detail();
let tennisplayer= new TennisPlayer('Rafael Nadal','Spain' ,34);
tennisplayer.tennisdetail();