Skip to content

Instantly share code, notes, and snippets.

View Damimd10's full-sized avatar

Damian Diaz Damimd10

  • Argentina
View GitHub Profile
@Damimd10
Damimd10 / machine.js
Created May 28, 2020 02:20
Generated by XState Viz: https://xstate.js.org/viz
const firstStep = {
initial: 'BREAK_UP',
states: {
BREAK_UP: {
on: {
START: 'START_PROPELLERS'
}
},
START_PROPELLERS: {
on: {
class Hero {
constructor(name) {
this.name = name
}
prepareForBattle(increaseCount) {
console.log(`I am ${this.name}! Let's go fighting!`)
increaseCount()
}
}
const superman = {
strong: true,
power: 120,
powerUp: function() {
setTimeout(function() {
if (this.power) this.power += 10
}, 10)
},
}
class Heroe {
constructor(name, isFromDC) {
this.name = name;
this.isFromDC = isFromDC;
}
info() {
console.log(`${this.name} is ${this.isFromDC ? '' : 'not '} from DC`)
}
}
const heroes = [
{
name: 'Batman',
isFromDC: true,
info: function() {
console.log(`${this.name} is ${this.isFromDC ? '' : 'not '} from DC.`)
},
},
{
const batman = {
isFromDC: true,
info: function() {
console.log(`Batman is ${this.isFromDC ? '' : 'not '}from DC`)
},
}
batman.info() // Batman is from DC.
{
const welcome = 'Welcome to our JS Workshop'
console.log(welcome) // 'Welcome to our JS Workshop'
}
console.log(welcome) // Error, welcome is not defined
var name = 'FDV';
function company() {
this.name = 'intive FDV';
}
company.prototype.name = 'intiveFDV Disney';
company.prototype.description = 'Great company to ...';
var name = 'Alexis';
var bestProjectManager = (function() {
var name = 'Julito';
return function() {
console.log(name); // log 'Julito'
};
})();
var name = 'Damian';
function Person() {
this.name = 'Leo';
}
console.log(new Person().name); // log 'Leo'