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
class ValidateEmailSimple { | |
isValid(email) { | |
return email.indexOf("@") > 2; | |
} | |
} | |
class ValidateEmailAdvanced { | |
isValid(email) { | |
var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; | |
return re.test(String(email).toLowerCase()); |
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
class ValidateEmailSimple { | |
isValid(email) { | |
return email.indexOf("@") > 2; | |
} | |
} | |
class ValidateEmailAdvanced { | |
isValid(email) { | |
var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; | |
return re.test(String(email).toLowerCase()); |
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
class Product { | |
setName({ name, onFinish = () => {} }) { | |
this.name = name; | |
onFinish(this); | |
} | |
} | |
const run = () => { | |
const ProductInstance = new Product(); |
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
class Product { | |
setName({ name, onFinish }) { | |
this.name = name; | |
onFinish(this); | |
} | |
} | |
const run = () => { | |
const ProductInstance = new Product(); |
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
class Retangle { | |
constructor({ width, length }) { | |
this.setWidth(width); | |
this.setLength(length); | |
} | |
setWidth(width) { | |
this.width = width; | |
} |
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
class Retangle { | |
constructor({ width, length }) { | |
this.setWidth(width); | |
this.setLength(length); | |
} | |
setWidth(width) { | |
this.width = width; | |
} |
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
class Sizes { | |
constructor() { | |
this.data = ["small", "medium", "big"]; | |
return this.data; | |
} | |
} | |
class Sandwich { | |
constructor({ name, size, price } = {}) { | |
this.setName(name); |
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
class Sandwich { | |
constructor({ name, size, price } = {}) { | |
this.setName(name); | |
this.setSize(size); | |
this.setPrice(price); | |
} | |
setName(name) { | |
this.name = name; | |
} |
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
class User { | |
constructor(name, age) { | |
this.name = name; | |
this.age = age; | |
} | |
setName(name) { | |
this.name = name; | |
} |
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
class User { | |
constructor(name, age) { | |
this.name = name; | |
this.age = age; | |
this.logs = []; | |
} | |
setName(name) { | |
this.name = name; | |
this.logs.push("Edited user name"); |