app.js
import log, {getTime, getCurrentHour} from './myLogger.js'
log('my first test data');
log(`getTime is ${getTime()}`);
log(`current hour is ${getCurrentHour()}`)
myLogger.js
export default function log(data) {
console.log(data);
}
export const getTime = () => {
return Date.now();
}
export const getCurrentHour = () => {
return (new Date).getHours();
}
app.js
import log, {MyLogger} from './myLogger.js'
const logger = new MyLogger();
log(logger.getLectures);
myLogger.js
export default function log(data) {
console.log(data);
}
export class MyLogger {
constructor(props){
this.lectures = ['java', 'iOS']
}
getLectures() {
return this.lectures;
}
getTime() {
return Date.now();
}
}