Skip to content

Instantly share code, notes, and snippets.

View devmeireles's full-sized avatar
🏠
Working from home

Gabriel Meireles devmeireles

🏠
Working from home
View GitHub Profile
class ItemList{
constructor(){
this.item = [];
}
addItem(){
this.item.push('Nuevo ítem');
console.log(this.item);
}
}
<!DOCTYPE html>
<html>
<head>
<title>Doc</title>
</head>
<body>
<button id="nuevoitem">Añadir</button>
<script src="./bundle.js"></script>
class ItemList{
constructor(){
this.item = [];
}
addItem(){
this.item.push('Nuevo ítem');
console.log(this.item);
}
}
class List{
constructor(){
this.data = [];
}
add(data){
this.data.push(data);
console.log(this.data);
}
}
class Media{
constructor(a, b, c, d){
this.a = a;
this.b = b;
this.c = c;
this.d = d;
}
static Sumar(a, b, c, d){
return ((a+b+c+d) / 4);
module.exports = {
entry: './main.js',
output: {
path: __dirname,
filename: 'bundle.js',
},
module:{
rules:[
{
test: /\.js$/,
import {sum} from './sum.js';
console.log(sum(2,10));
export function sum(a, b){
return a + b;
}
<!DOCTYPE html>
<html>
<head>
<title>Doc</title>
</head>
<body>
<script src="./bundle.js"></script>
</body>
import axios from 'axios';
class Api{
static async getUserInfo(username){
try{
const response = await axios.get('https://api.github.com/users/'+username);
console.log(response);
} catch (err){
console.warn('Error');
}