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
function isDivisibleByY(n, y) { | |
return n % y === 0; // returns true or false | |
} | |
function createNewArray(n) { | |
return Array.from(Array(n).keys()).map(i => ++i) | |
} | |
function print(string) { | |
console.log(string); |
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
for(var i = 1; i < 101; i++) { | |
if(i % 3 === 0 && i % 5 === 0) { | |
console.log('Fizz Buzz'); | |
} | |
if(i % 5 === 0) { | |
console.log('Fizz'); | |
} | |
if(i % 3 === 0) { | |
console.log('Buzz') | |
} |
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
// 1: just returns undefined | |
function isEven(num) { | |
if(num === 0) { | |
return true; | |
} | |
else if(num === 1) { | |
return false; | |
} | |
else { |
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
function foo() { | |
return { | |
input: this.input, | |
delimiter: this.delimier, | |
push: function(newString) { | |
this.input = this.input ? this.input + this.delimiter + newString : newString; | |
}, | |
pop: function() { | |
const LAST_INDEX = this.input.lastIndexOf(this.delimiter); | |
this.input = (LAST_INDEX !== -1) ? this.input.substring(0, LAST_INDEX) : ''; |
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
function foo(arg1, arg2) { | |
return { | |
input: arg1, | |
delimiter: arg2, | |
push: function (newString) { | |
this.input = this.input ? this.input + this.delimiter + newString : newString; | |
}, | |
pop: function () { | |
const LAST_INDEX = this.input.lastIndexOf(this.delimiter); | |
this.input = (LAST_INDEX !== -1) ? this.input.substring(0, LAST_INDEX) : ''; |
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
// class | |
class foo { | |
constructor(a, b) { | |
this.a = a; | |
this.b = b; | |
} | |
bar() { | |
return true; |
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
<div class="foo" | |
id="bar" | |
data-info="foobar" | |
aria-hidden="true" | |
role="button"> | |
</div> |
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 checkIfArray from './checkIfArray'; | |
function checkIfString(x) { | |
x.forEach(function(el) { | |
if (typeof el !== 'string') { | |
throw new Error('Array can only contain strings'); | |
} | |
}); | |
} |
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
{ | |
"parser": "babel-eslint", | |
"extends": "plugin:flowtype/recommended", | |
"plugins": ["eslint-plugin-flowtype"], | |
"settings": { | |
"flowtype": { | |
"onlyFilesWithFlowAnnotation": true | |
} | |
}, | |
"env": { |
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
// @flow | |
import React, { Component } from 'react'; | |
import logo from './logo.svg'; | |
import './App.css'; | |
type Props = { | |
name: string, | |
age: number, | |
DOB: number, |