forked from mouredev/hello-javascript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path28-export-modules.js
More file actions
51 lines (35 loc) · 737 Bytes
/
28-export-modules.js
File metadata and controls
51 lines (35 loc) · 737 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
Clase 7 en vídeo | 21/08/2024
Console y módulos
https://www.youtube.com/live/PAnxhBE5kIE?si=V0F_NsKO9lmhhatu&t=555
*/
// Exportación de módulos
// Funciones
export function add(a, b) {
return a + b
}
console.log(add(5, 10))
// Propiedades
export const PI = 3.1416
export let name = "MoureDev"
// Clases
export class Circle {
constructor(radius) {
this.radius = radius
}
area() {
return Math.PI * Math.pow(this.radius, 2)
}
perimeter() {
return 2 * Math.PI * this.radius
}
}
// Exportación por defecto
export default function substract(a, b) {
return a - b
}
// export default class MyClass {
// func() {
// console.log("Mi clase")
// }
// }