SimonSelg
var weAreConnected = Math.floor(Math.random() * 10) > 5
if (weAreConnected === true) {
this.setState({
isConnected: true
})
}
else {
this.setState({
isConnected: false
})
}
Instead, simplify the logic var weAreConnected = Math.floor(Math.random() * 10) > 5
this.setState({
isConnected: weAreConnected
})
The random choice is also overy complicate (and on a side node, the value is more likely to be false then true due incorrect comparision operator usage) var weAreConnected = Math.random() < 0.5
this.setState({
isConnected: weAreConnected
})
If we use ES6, we can use the shorthand notation to simplify the code even more const isConnected = Math.random() < 0.5
this.setState({
isConnected
})const target = 'Get on the Road' const result = target.replace(/road/i, 'bus')
For example, my goal is to get bigger (build up more muscles & get stronger) - and I can monitor my progress - which generates motivation ("oh today I was able to do this exercise with more weight then the last time!")
In my recent lasts that has been either - social activities that I value more then gym (doesn't happen that often) - you can normally scedule that part of your life
- Work that pays off that well that skipping gym is worth it. For example , I have a small company w/ a friend (full stack development) and we got this new customer who was paying really good and who what a lot of connections - so I ended up working 18h/day on that project for like 2 weeks. But was totally worth it.
In general I can recommend weight lifting to anyone who spends most if his time siting in front of a computer (I thing most of us here are) - for me it's totally fun (I love to push myself to that point where I'm 100% exhausted) and great for compensating other stuff.
Try it for a few weeks - you might actually enjoy it! And you'll enjoy the results for sure.