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
const object = {}; | |
object + object | |
// "[object Object][object Object]" | |
object - object | |
// NaN | |
object * object | |
// NaN | |
object / object | |
// NaN |
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
const myBirthday = new Date('1987-07-22'); | |
const myPartnersBirthday = new Date('1988-06-08'); | |
const together = myBirthday + myPartnersBirthday; | |
// "Wed Jul 22 1987 02:00:00 GMT+0200 (CEST)Wed Jun 08 1988 02:00:00 GMT+0200 (CEST)" |
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
const myBirthday = new Date('1987-07-22'); | |
const rightNow = new Date(); | |
const numberOfMsIHaveLived = rightNow - myBirthday; | |
// 974911520369 or thereabouts |
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
const milliseconds = +new Date(); |
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
const milliseconds = Date.now(); |
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
const aDateInstance = new Date(); | |
const millisecondsSince1970 = aDateInstance.getTime(); |
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
import React, { Component } from 'react'; | |
import { connect } from 'react-redux'; | |
import * as dispatchers from '../dispatchers'; | |
class ProfilePage extends Component { | |
componentDidMount() { | |
this.props.getUser(); | |
} | |
render() {...} // Not really relevant here | |
} |
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
import * as actions from '../actions'; | |
const getUser = () => async dispatch => { | |
dispatch(actions.getUserRequested()); | |
const response = await fetch('/api/user'); | |
const user = await response.json(); | |
dispatch(actions.getUserReceived(user); | |
}; | |
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
import tp from 'timeproxy'; | |
const SESSION_EXPIRES = tp`in 30 seconds`; | |
const OLD_POST_TIMESTAMP = tp`two weeks ago` |
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
import tp from 'timeproxy'; | |
const TIME_UNTIL_NEXT_PUSH = tp`one week and a day`; | |
const SHOW_DONT_LEAVE_DELAY = tp`12 minutes 2 seconds`; | |
const WOW = tp`9 weeks twelve days and .5 seconds`; |