This file contains 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 Button extends React.Component{ | |
state = { switch: 0 }; | |
onClickHandle = () => { | |
if( this.state.switch === 1){ | |
this.props.onclickFunction(-1 * this.props.changeValue); | |
this.setState({ switch : 0}); | |
} | |
else{ |
This file contains 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
// Just shows the time, taking app state time as input prop | |
const Timer = function(props) { | |
return ( | |
<h1> | |
{props.time} | |
</h1> | |
); | |
}; |
This file contains 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 Card = function(props) { | |
return ( | |
<div | |
style={{display: 'flex', | |
border: "1px solid #f0f0f0", | |
marginBottom: "10px" , | |
alignItems: 'center'}}> | |
<img | |
width="150px" | |
src={props.imageURL} alt=""/> |
This file contains 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
// https://hackernoon.com/how-to-lose-an-it-job-in-10-minutes-3d63213c8370 | |
var city = "Tokyo"; | |
var cities = ['Tokyo', 'London', 'Rome', 'Donlon', 'Kyoto', 'Paris']; | |
function getScore(s){ | |
var s = s.toLowerCase(); | |
var sum = 0; | |
for(var i = 0; i < s.length;i++){ |
This file contains 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
{"lastUpload":"2019-05-19T17:51:26.031Z","extensionVersion":"v3.2.9"} |
This file contains 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
// This is the decorator function that times our functions | |
function timer(target, name, descriptor) { | |
console.log(target, name, descriptor); | |
let original = descriptor.value; | |
descriptor.value = function(...args){ | |
console.time('timer'); | |
var result = original.apply(this, args); | |
console.timeEnd('timer'); | |
return result; | |
} |
This file contains 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 Dog { | |
constructor(name = "default") { | |
this.name = name; | |
console.log("My name is ", name); | |
} | |
} | |
module.exports = Dog; |