Skip to content

Instantly share code, notes, and snippets.

@DesireeBesnard
Created November 3, 2020 13:00
Show Gist options
  • Save DesireeBesnard/3733949d5046621eb044b45be07bd0fc to your computer and use it in GitHub Desktop.
Save DesireeBesnard/3733949d5046621eb044b45be07bd0fc to your computer and use it in GitHub Desktop.
ES6 Classes, Fonctions an Destruct synthax
class Screen extends Component {
constructor(props) {
super(props)
this.state = { logginState: 'logged-out'}
}
render() {
}
}
// const firstName = this.props.firstName
// const lastName = this.props.lastName
// const onClick= this.props.onClick
const { firstName, lastName, onClick} = this.props
const person = {
firstName: 'John',
lastName: 'Smith',
set fullName(fullName) {
// const names = fullName.split(' ')
// this.firstName = names[0]
// this.lastName = names[1]
[this.firstName, this.lastName] = fullname.split(' ')
}
}
const adults = []
const minors = []
people.forEach((person) => {
if (person.age >= 18) {
adults.push(person)
} else {
minors.push(person)
}
})
people.map((person) => person.firstName)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment