diff --git a/snippets/JSONToDate.md b/snippets/JSONToDate.md index 38e9219f9..f2cbb095b 100644 --- a/snippets/JSONToDate.md +++ b/snippets/JSONToDate.md @@ -12,5 +12,5 @@ const JSONToDate = arr => { ``` ```js -JSONToDate(/Date(1489525200000)/) -> "14/3/2017" +JSONToDate(/Date(1489525200000)/) // "14/3/2017" ``` diff --git a/snippets/JSONToFile.md b/snippets/JSONToFile.md index 300b47e1f..2e88f336d 100644 --- a/snippets/JSONToFile.md +++ b/snippets/JSONToFile.md @@ -10,5 +10,5 @@ const JSONToFile = (obj, filename) => fs.writeFile(`${filename}.json`, JSON.stri ``` ```js -JSONToFile({test: "is passed"}, 'testJsonFile') -> writes the object to 'testJsonFile.json' +JSONToFile({test: "is passed"}, 'testJsonFile') // writes the object to 'testJsonFile.json' ``` diff --git a/snippets/RGBToHex.md b/snippets/RGBToHex.md index f7568f70f..a7f045ab7 100644 --- a/snippets/RGBToHex.md +++ b/snippets/RGBToHex.md @@ -9,5 +9,5 @@ const RGBToHex = (r, g, b) => ((r << 16) + (g << 8) + b).toString(16).padStart(6 ``` ```js -RGBToHex(255, 165, 1) -> 'ffa501' +RGBToHex(255, 165, 1) // 'ffa501' ``` diff --git a/snippets/UUIDGenerator.md b/snippets/UUIDGenerator.md index 87300e5ed..2fc772940 100644 --- a/snippets/UUIDGenerator.md +++ b/snippets/UUIDGenerator.md @@ -12,5 +12,5 @@ const UUIDGenerator = () => ``` ```js -UUIDGenerator() -> '7982fcfe-5721-4632-bede-6000885be57d' +UUIDGenerator() // '7982fcfe-5721-4632-bede-6000885be57d' ``` diff --git a/snippets/anagrams.md b/snippets/anagrams.md index 2238c4a5f..82684871c 100644 --- a/snippets/anagrams.md +++ b/snippets/anagrams.md @@ -16,5 +16,5 @@ const anagrams = str => { ``` ```js -anagrams('abc') -> ['abc','acb','bac','bca','cab','cba'] +anagrams('abc') // ['abc','acb','bac','bca','cab','cba'] ``` diff --git a/snippets/arrayAverage.md b/snippets/arrayAverage.md index 92c54518b..1cc3cecb4 100644 --- a/snippets/arrayAverage.md +++ b/snippets/arrayAverage.md @@ -9,5 +9,5 @@ const arrayAverage = arr => arr.reduce((acc, val) => acc + val, 0) / arr.length; ``` ```js -arrayAverage([1,2,3]) -> 2 +arrayAverage([1,2,3]) // 2 ``` diff --git a/snippets/arrayGcd.md b/snippets/arrayGcd.md index df657f31a..975b7ecc4 100644 --- a/snippets/arrayGcd.md +++ b/snippets/arrayGcd.md @@ -12,6 +12,6 @@ const arrayGcd = arr =>{ ``` ```js -arrayGcd([1,2,3,4,5]) -> 1 -arrayGcd([4,8,12]) -> 4 +arrayGcd([1,2,3,4,5]) // 1 +arrayGcd([4,8,12]) // 4 ``` diff --git a/snippets/arrayLcm.md b/snippets/arrayLcm.md index fd82831f5..e50555e2e 100644 --- a/snippets/arrayLcm.md +++ b/snippets/arrayLcm.md @@ -13,6 +13,6 @@ const arrayLcm = arr =>{ ``` ```js -arrayLcm([1,2,3,4,5]) -> 60 -arrayLcm([4,8,12]) -> 24 +arrayLcm([1,2,3,4,5]) // 60 +arrayLcm([4,8,12]) // 24 ``` diff --git a/snippets/arrayMax.md b/snippets/arrayMax.md index 3e1b5c5e8..32178d533 100644 --- a/snippets/arrayMax.md +++ b/snippets/arrayMax.md @@ -9,5 +9,5 @@ const arrayMax = arr => Math.max(...arr); ``` ```js -arrayMax([10, 1, 5]) -> 10 +arrayMax([10, 1, 5]) // 10 ``` diff --git a/snippets/arrayMin.md b/snippets/arrayMin.md index 171d60977..1e256b388 100644 --- a/snippets/arrayMin.md +++ b/snippets/arrayMin.md @@ -9,5 +9,5 @@ const arrayMin = arr => Math.min(...arr); ``` ```js -arrayMin([10, 1, 5]) -> 1 +arrayMin([10, 1, 5]) // 1 ``` diff --git a/snippets/arraySum.md b/snippets/arraySum.md index 9c3178d35..536a4eb81 100644 --- a/snippets/arraySum.md +++ b/snippets/arraySum.md @@ -9,5 +9,5 @@ const arraySum = arr => arr.reduce((acc, val) => acc + val, 0); ``` ```js -arraySum([1,2,3,4]) -> 10 +arraySum([1,2,3,4]) // 10 ``` diff --git a/snippets/bottomVisible.md b/snippets/bottomVisible.md index 485f1879f..844d11b31 100644 --- a/snippets/bottomVisible.md +++ b/snippets/bottomVisible.md @@ -10,5 +10,5 @@ const bottomVisible = () => ``` ```js -// bottomVisible() -> true +// bottomVisible() // true ``` diff --git a/snippets/capitalize.md b/snippets/capitalize.md index 435b69202..2b8a6e216 100644 --- a/snippets/capitalize.md +++ b/snippets/capitalize.md @@ -11,6 +11,6 @@ const capitalize = ([first,...rest], lowerRest = false) => ``` ```js -capitalize('fooBar') -> 'FooBar' -capitalize('fooBar', true) -> 'Foobar' +capitalize('fooBar') // 'FooBar' +capitalize('fooBar', true) // 'Foobar' ``` diff --git a/snippets/capitalizeEveryWord.md b/snippets/capitalizeEveryWord.md index b607f8f58..dd3193c3e 100644 --- a/snippets/capitalizeEveryWord.md +++ b/snippets/capitalizeEveryWord.md @@ -9,5 +9,5 @@ const capitalizeEveryWord = str => str.replace(/\b[a-z]/g, char => char.toUpperC ``` ```js -capitalizeEveryWord('hello world!') -> 'Hello World!' +capitalizeEveryWord('hello world!') // 'Hello World!' ``` diff --git a/snippets/chunk.md b/snippets/chunk.md index 122712351..f27fe965c 100644 --- a/snippets/chunk.md +++ b/snippets/chunk.md @@ -12,5 +12,5 @@ const chunk = (arr, size) => ``` ```js -chunk([1,2,3,4,5], 2) -> [[1,2],[3,4],[5]] +chunk([1,2,3,4,5], 2) // [[1,2],[3,4],[5]] ``` diff --git a/snippets/clampNumber.md b/snippets/clampNumber.md index 907b54729..3ae9eda45 100644 --- a/snippets/clampNumber.md +++ b/snippets/clampNumber.md @@ -14,7 +14,7 @@ const clampNumber = (num, lower, upper) => { ``` ```js -clampNumber(2, 3, 5) -> 3 -clampNumber(1, -1, -5) -> -1 -clampNumber(3, 2, 4) -> 3 +clampNumber(2, 3, 5) // 3 +clampNumber(1, -1, -5) // -1 +clampNumber(3, 2, 4) // 3 ``` diff --git a/snippets/coalesce.md b/snippets/coalesce.md index 9762a363f..c112c77d4 100644 --- a/snippets/coalesce.md +++ b/snippets/coalesce.md @@ -9,5 +9,5 @@ const coalesce = (...args) => args.find(_ => ![undefined, null].includes(_)) ``` ```js -coalesce(null,undefined,"",NaN, "Waldo") -> "" +coalesce(null,undefined,"",NaN, "Waldo") // "" ``` diff --git a/snippets/collatz.md b/snippets/collatz.md index fc05b2a5d..de67f674c 100644 --- a/snippets/collatz.md +++ b/snippets/collatz.md @@ -9,6 +9,6 @@ const collatz = n => (n % 2 == 0) ? (n / 2) : (3 * n + 1); ``` ```js -collatz(8) -> 4 -collatz(5) -> 16 +collatz(8) // 4 +collatz(5) // 16 ``` diff --git a/snippets/compact.md b/snippets/compact.md index 2a9528772..07f4e9900 100644 --- a/snippets/compact.md +++ b/snippets/compact.md @@ -9,5 +9,5 @@ const compact = arr => arr.filter(Boolean); ``` ```js -compact([0, 1, false, 2, '', 3, 'a', 'e'*23, NaN, 's', 34]) -> [ 1, 2, 3, 'a', 's', 34 ] +compact([0, 1, false, 2, '', 3, 'a', 'e'*23, NaN, 's', 34]) // [ 1, 2, 3, 'a', 's', 34 ] ``` diff --git a/snippets/compose.md b/snippets/compose.md index dfd40f814..c271a50e8 100644 --- a/snippets/compose.md +++ b/snippets/compose.md @@ -13,5 +13,5 @@ const compose = (...fns) => fns.reduce((f, g) => (...args) => f(g(...args))); const add5 = x => x + 5 const multiply = (x, y) => x * y const multiplyAndAdd5 = compose(add5, multiply) -multiplyAndAdd5(5, 2) -> 15 +multiplyAndAdd5(5, 2) // 15 ``` diff --git a/snippets/countOccurrences.md b/snippets/countOccurrences.md index 2c1463b02..d68c83acf 100644 --- a/snippets/countOccurrences.md +++ b/snippets/countOccurrences.md @@ -9,5 +9,5 @@ const countOccurrences = (arr, value) => arr.reduce((a, v) => v === value ? a + ``` ```js -countOccurrences([1,1,2,1,2,3], 1) -> 3 +countOccurrences([1,1,2,1,2,3], 1) // 3 ``` diff --git a/snippets/countVowels.md b/snippets/countVowels.md index 47c683eb8..50cf6cafa 100644 --- a/snippets/countVowels.md +++ b/snippets/countVowels.md @@ -9,6 +9,6 @@ const countVowels = str => (str.match(/[aeiou]/ig) || []).length; ``` ```js -countVowels('foobar') -> 3 -countVowels('gym') -> 0 +countVowels('foobar') // 3 +countVowels('gym') // 0 ``` diff --git a/snippets/currentURL.md b/snippets/currentURL.md index 7e8965d92..0fab76ab3 100644 --- a/snippets/currentURL.md +++ b/snippets/currentURL.md @@ -9,5 +9,5 @@ const currentURL = () => window.location.href; ``` ```js -currentUrl() -> 'https://google.com' +currentUrl() // 'https://google.com' ``` diff --git a/snippets/curry.md b/snippets/curry.md index f1806d395..c316acff2 100644 --- a/snippets/curry.md +++ b/snippets/curry.md @@ -15,6 +15,6 @@ const curry = (fn, arity = fn.length, ...args) => ``` ```js -curry(Math.pow)(2)(10) -> 1024 -curry(Math.min, 3)(10)(50)(2) -> 2 +curry(Math.pow)(2)(10) // 1024 +curry(Math.min, 3)(10)(50)(2) // 2 ``` diff --git a/snippets/deepFlatten.md b/snippets/deepFlatten.md index cea888992..c6c9d2807 100644 --- a/snippets/deepFlatten.md +++ b/snippets/deepFlatten.md @@ -11,5 +11,5 @@ const deepFlatten = arr => [].concat(...arr.map(v => Array.isArray(v) ? deepFlat ``` ```js -deepFlatten([1,[2],[[3],4],5]) -> [1,2,3,4,5] +deepFlatten([1,[2],[[3],4],5]) // [1,2,3,4,5] ``` diff --git a/snippets/detectDeviceType.md b/snippets/detectDeviceType.md index 64888d44e..b262e194d 100644 --- a/snippets/detectDeviceType.md +++ b/snippets/detectDeviceType.md @@ -9,6 +9,6 @@ const detectDeviceType = () => /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobi ``` ```js -detectDeviceType() -> "Mobile" -detectDeviceType() -> "Desktop" +detectDeviceType() // "Mobile" +detectDeviceType() // "Desktop" ``` diff --git a/snippets/difference.md b/snippets/difference.md index dce891e60..486d4b050 100644 --- a/snippets/difference.md +++ b/snippets/difference.md @@ -9,5 +9,5 @@ const difference = (a, b) => { const s = new Set(b); return a.filter(x => !s.has ``` ```js -difference([1,2,3], [1,2,4]) -> [3] +difference([1,2,3], [1,2,4]) // [3] ``` diff --git a/snippets/differenceWith.md b/snippets/differenceWith.md index c199a62bd..f5ad345d6 100644 --- a/snippets/differenceWith.md +++ b/snippets/differenceWith.md @@ -9,5 +9,5 @@ const differenceWith = (arr, val, comp) => arr.filter(a => !val.find(b => comp(a ``` ```js -differenceWith([1, 1.2, 1.5, 3], [1.9, 3], (a,b) => Math.round(a) == Math.round(b)) -> [1, 1.2] +differenceWith([1, 1.2, 1.5, 3], [1.9, 3], (a,b) => Math.round(a) == Math.round(b)) // [1, 1.2] ``` diff --git a/snippets/digitize.md b/snippets/digitize.md index b9d6cffbd..9d52fd04b 100644 --- a/snippets/digitize.md +++ b/snippets/digitize.md @@ -10,5 +10,5 @@ const digitize = n => [...''+n].map(i => parseInt(i)); ``` ```js -differenceWith([1, 1.2, 1.5, 3], [1.9, 3], (a,b) => Math.round(a) == Math.round(b)) -> [1, 1.2] +differenceWith([1, 1.2, 1.5, 3], [1.9, 3], (a,b) => Math.round(a) == Math.round(b)) // [1, 1.2] ``` diff --git a/snippets/distance.md b/snippets/distance.md index 543c763a6..bfc29b8dc 100644 --- a/snippets/distance.md +++ b/snippets/distance.md @@ -9,5 +9,5 @@ const distance = (x0, y0, x1, y1) => Math.hypot(x1 - x0, y1 - y0); ``` ```js -distance(1,1, 2,3) -> 2.23606797749979 +distance(1,1, 2,3) // 2.23606797749979 ``` diff --git a/snippets/distinctValuesOfArray.md b/snippets/distinctValuesOfArray.md index 374e24cef..509738a40 100644 --- a/snippets/distinctValuesOfArray.md +++ b/snippets/distinctValuesOfArray.md @@ -9,5 +9,5 @@ const distinctValuesOfArray = arr => [...new Set(arr)]; ``` ```js -distinctValuesOfArray([1,2,2,3,4,4,5]) -> [1,2,3,4,5] +distinctValuesOfArray([1,2,2,3,4,4,5]) // [1,2,3,4,5] ``` diff --git a/snippets/dropElements.md b/snippets/dropElements.md index 064a16d22..a9632c634 100644 --- a/snippets/dropElements.md +++ b/snippets/dropElements.md @@ -13,5 +13,5 @@ const dropElements = (arr, func) => { ``` ```js -dropElements([1, 2, 3, 4], n => n >= 3) -> [3,4] +dropElements([1, 2, 3, 4], n => n >= 3) // [3,4] ``` diff --git a/snippets/dropRight.md b/snippets/dropRight.md index 11d30d198..cdf8fd458 100644 --- a/snippets/dropRight.md +++ b/snippets/dropRight.md @@ -9,7 +9,7 @@ const dropRight = (arr, n = 1) => arr.slice(0, -n); ``` ```js -dropRight([1,2,3]) -> [1,2] -dropRight([1,2,3], 2) -> [1] -dropRight([1,2,3], 42) -> [] +dropRight([1,2,3]) // [1,2] +dropRight([1,2,3], 2) // [1] +dropRight([1,2,3], 42) // [] ``` diff --git a/snippets/elementIsVisibleInViewport.md b/snippets/elementIsVisibleInViewport.md index 83e6afe71..ed2933efe 100644 --- a/snippets/elementIsVisibleInViewport.md +++ b/snippets/elementIsVisibleInViewport.md @@ -20,6 +20,6 @@ const elementIsVisibleInViewport = (el, partiallyVisible = false) => { ```js // e.g. 100x100 viewport and a 10x10px element at position {top: -1, left: 0, bottom: 9, right: 10} -elementIsVisibleInViewport(el) -> false // (not fully visible) -elementIsVisibleInViewport(el, true) -> true // (partially visible) +elementIsVisibleInViewport(el) // false // (not fully visible) +elementIsVisibleInViewport(el, true) // true // (partially visible) ``` diff --git a/snippets/escapeRegExp.md b/snippets/escapeRegExp.md index 7fdbff462..f82850d2b 100644 --- a/snippets/escapeRegExp.md +++ b/snippets/escapeRegExp.md @@ -9,5 +9,5 @@ const escapeRegExp = str => str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); ``` ```js -escapeRegExp('(test)') -> \\(test\\) +escapeRegExp('(test)') // \\(test\\) ``` diff --git a/snippets/everyNth.md b/snippets/everyNth.md index 6aa78ac69..2fab65d47 100644 --- a/snippets/everyNth.md +++ b/snippets/everyNth.md @@ -9,5 +9,5 @@ const everyNth = (arr, nth) => arr.filter((e, i) => i % nth === nth - 1); ``` ```js -everyNth([1,2,3,4,5,6], 2) -> [ 2, 4, 6 ] +everyNth([1,2,3,4,5,6], 2) // [ 2, 4, 6 ] ``` diff --git a/snippets/extendHex.md b/snippets/extendHex.md index 9338fb139..40253a7f1 100644 --- a/snippets/extendHex.md +++ b/snippets/extendHex.md @@ -10,6 +10,6 @@ const extendHex = shortHex => ``` ```js -extendHex('#03f') -> '#0033ff' -extendHex('05a') -> '#0055aa' +extendHex('#03f') // '#0033ff' +extendHex('05a') // '#0055aa' ``` diff --git a/snippets/factorial.md b/snippets/factorial.md index f4f4ad941..f1fa9bd29 100644 --- a/snippets/factorial.md +++ b/snippets/factorial.md @@ -14,5 +14,5 @@ const factorial = n => ``` ```js -factorial(6) -> 720 +factorial(6) // 720 ``` diff --git a/snippets/fibonacci.md b/snippets/fibonacci.md index 9addac34a..474bba30d 100644 --- a/snippets/fibonacci.md +++ b/snippets/fibonacci.md @@ -11,5 +11,5 @@ const fibonacci = n => ``` ```js -factorial(6) -> 720 +factorial(6) // 720 ``` diff --git a/snippets/fibonacciCountUntilNum.md b/snippets/fibonacciCountUntilNum.md index 82f53ea98..719e8cef3 100644 --- a/snippets/fibonacciCountUntilNum.md +++ b/snippets/fibonacciCountUntilNum.md @@ -10,5 +10,5 @@ const fibonacciCountUntilNum = num => ``` ```js -fibonacciCountUntilNum(10) -> 7 +fibonacciCountUntilNum(10) // 7 ``` diff --git a/snippets/fibonacciUntilNum.md b/snippets/fibonacciUntilNum.md index c7ad1cd6e..bae5456b9 100644 --- a/snippets/fibonacciUntilNum.md +++ b/snippets/fibonacciUntilNum.md @@ -14,5 +14,5 @@ const fibonacciUntilNum = num => { ``` ```js -fibonacciCountUntilNum(10) -> 7 +fibonacciCountUntilNum(10) // 7 ``` diff --git a/snippets/filterNonUnique.md b/snippets/filterNonUnique.md index 1568afbf8..cfce97f56 100644 --- a/snippets/filterNonUnique.md +++ b/snippets/filterNonUnique.md @@ -9,5 +9,5 @@ const filterNonUnique = arr => arr.filter(i => arr.indexOf(i) === arr.lastIndexO ``` ```js -filterNonUnique([1,2,2,3,4,4,5]) -> [1,3,5] +filterNonUnique([1,2,2,3,4,4,5]) // [1,3,5] ``` diff --git a/snippets/flatten.md b/snippets/flatten.md index 66b5b86ad..29cb52ad1 100644 --- a/snippets/flatten.md +++ b/snippets/flatten.md @@ -9,5 +9,5 @@ const flatten = arr => [ ].concat( ...arr ); ``` ```js -flatten([1,[2],3,4]) -> [1,2,3,4] +flatten([1,[2],3,4]) // [1,2,3,4] ``` diff --git a/snippets/flattenDepth.md b/snippets/flattenDepth.md index 6034b9135..a08563ca5 100644 --- a/snippets/flattenDepth.md +++ b/snippets/flattenDepth.md @@ -14,5 +14,5 @@ const flattenDepth = (arr, depth = 1) => ``` ```js -flatten([1,[2],3,4]) -> [1,2,3,4] +flatten([1,[2],3,4]) // [1,2,3,4] ``` diff --git a/snippets/fromCamelCase.md b/snippets/fromCamelCase.md index 14c21bc4c..9a74226f7 100644 --- a/snippets/fromCamelCase.md +++ b/snippets/fromCamelCase.md @@ -12,7 +12,7 @@ const fromCamelCase = (str, separator = '_') => ``` ```js -fromCamelCase('someDatabaseFieldName', ' ') -> 'some database field name' -fromCamelCase('someLabelThatNeedsToBeCamelized', '-') -> 'some-label-that-needs-to-be-camelized' -fromCamelCase('someJavascriptProperty', '_') -> 'some_javascript_property' +fromCamelCase('someDatabaseFieldName', ' ') // 'some database field name' +fromCamelCase('someLabelThatNeedsToBeCamelized', '-') // 'some-label-that-needs-to-be-camelized' +fromCamelCase('someJavascriptProperty', '_') // 'some_javascript_property' ``` diff --git a/snippets/functionName.md b/snippets/functionName.md index 1ad25772a..17869a6a6 100644 --- a/snippets/functionName.md +++ b/snippets/functionName.md @@ -9,5 +9,5 @@ const functionName = fn => (console.debug(fn.name), fn); ``` ```js -functionName(Math.max) -> max (logged in debug channel of console) +functionName(Math.max) // max (logged in debug channel of console) ``` diff --git a/snippets/gcd.md b/snippets/gcd.md index 8affada12..f3faa5057 100644 --- a/snippets/gcd.md +++ b/snippets/gcd.md @@ -11,5 +11,5 @@ const gcd = (x, y) => !y ? x : gcd(y, x % y); ``` ```js -gcd (8, 36) -> 4 +gcd (8, 36) // 4 ``` diff --git a/snippets/getDaysDiffBetweenDates.md b/snippets/getDaysDiffBetweenDates.md index 6c73366ac..f0f4d5763 100644 --- a/snippets/getDaysDiffBetweenDates.md +++ b/snippets/getDaysDiffBetweenDates.md @@ -9,5 +9,5 @@ const getDaysDiffBetweenDates = (dateInitial, dateFinal) => (dateFinal - dateIni ``` ```js -getDaysDiffBetweenDates(new Date("2017-12-13"), new Date("2017-12-22")) -> 9 +getDaysDiffBetweenDates(new Date("2017-12-13"), new Date("2017-12-22")) // 9 ``` diff --git a/snippets/getScrollPosition.md b/snippets/getScrollPosition.md index 2708210a1..4860b0293 100644 --- a/snippets/getScrollPosition.md +++ b/snippets/getScrollPosition.md @@ -12,5 +12,5 @@ const getScrollPosition = (el = window) => ``` ```js -getScrollPosition() -> {x: 0, y: 200} +getScrollPosition() // {x: 0, y: 200} ``` diff --git a/snippets/getType.md b/snippets/getType.md index f0b9be8d5..655f62adb 100644 --- a/snippets/getType.md +++ b/snippets/getType.md @@ -10,5 +10,5 @@ const getType = v => ``` ```js -getType(new Set([1,2,3])) -> "set" +getType(new Set([1,2,3])) // "set" ``` diff --git a/snippets/getURLParameters.md b/snippets/getURLParameters.md index 5f4690bfc..b1e138450 100644 --- a/snippets/getURLParameters.md +++ b/snippets/getURLParameters.md @@ -13,5 +13,5 @@ const getURLParameters = url => ``` ```js -getURLParameters('http://url.com/page?name=Adam&surname=Smith') -> {name: 'Adam', surname: 'Smith'} +getURLParameters('http://url.com/page?name=Adam&surname=Smith') // {name: 'Adam', surname: 'Smith'} ``` diff --git a/snippets/groupBy.md b/snippets/groupBy.md index 4b301e2b8..bebea215c 100644 --- a/snippets/groupBy.md +++ b/snippets/groupBy.md @@ -12,6 +12,6 @@ const groupBy = (arr, func) => ``` ```js -groupBy([6.1, 4.2, 6.3], Math.floor) -> {4: [4.2], 6: [6.1, 6.3]} -groupBy(['one', 'two', 'three'], 'length') -> {3: ['one', 'two'], 5: ['three']} +groupBy([6.1, 4.2, 6.3], Math.floor) // {4: [4.2], 6: [6.1, 6.3]} +groupBy(['one', 'two', 'three'], 'length') // {3: ['one', 'two'], 5: ['three']} ``` diff --git a/snippets/hammingDistance.md b/snippets/hammingDistance.md index e0f22dba7..aedc72ce8 100644 --- a/snippets/hammingDistance.md +++ b/snippets/hammingDistance.md @@ -11,5 +11,5 @@ const hammingDistance = (num1, num2) => ``` ```js -hammingDistance(2,3) -> 1 +hammingDistance(2,3) // 1 ``` diff --git a/snippets/head.md b/snippets/head.md index 30b8951a6..b48d9bb1d 100644 --- a/snippets/head.md +++ b/snippets/head.md @@ -9,5 +9,5 @@ const head = arr => arr[0]; ``` ```js -head([1,2,3]) -> 1 +head([1,2,3]) // 1 ``` diff --git a/snippets/hexToRGB.md b/snippets/hexToRGB.md index d3fab8a8d..c24323286 100644 --- a/snippets/hexToRGB.md +++ b/snippets/hexToRGB.md @@ -19,7 +19,7 @@ const hexToRGB = hex => { ``` ```js -hexToRGB('#27ae60ff') -> 'rgba(39, 174, 96, 255)' -hexToRGB('27ae60') -> 'rgb(39, 174, 96)' -hexToRGB('#fff') -> 'rgb(255, 255, 255)' +hexToRGB('#27ae60ff') // 'rgba(39, 174, 96, 255)' +hexToRGB('27ae60') // 'rgb(39, 174, 96)' +hexToRGB('#fff') // 'rgb(255, 255, 255)' ``` diff --git a/snippets/inRange.md b/snippets/inRange.md index f4caf811c..044b32a0c 100644 --- a/snippets/inRange.md +++ b/snippets/inRange.md @@ -13,8 +13,8 @@ const inRange = (n, start, end=null) => { ``` ```js -inRange(3, 2, 5) -> true -inRange(3, 4) -> true -inRange(2, 3, 5) -> false -inrange(3, 2) -> false +inRange(3, 2, 5) // true +inRange(3, 4) // true +inRange(2, 3, 5) // false +inrange(3, 2) // false ``` diff --git a/snippets/initial.md b/snippets/initial.md index 87827c437..be178bcc8 100644 --- a/snippets/initial.md +++ b/snippets/initial.md @@ -9,5 +9,5 @@ const initial = arr => arr.slice(0, -1); ``` ```js -initial([1,2,3]) -> [1,2] +initial([1,2,3]) // [1,2] ``` diff --git a/snippets/initialize2DArray.md b/snippets/initialize2DArray.md index add743115..bde4ba879 100644 --- a/snippets/initialize2DArray.md +++ b/snippets/initialize2DArray.md @@ -9,5 +9,5 @@ const initialize2DArray = (w, h, val = null) => Array(h).fill().map(() => Array( ``` ```js -initialize2DArray(2, 2, 0) -> [[0,0], [0,0]] +initialize2DArray(2, 2, 0) // [[0,0], [0,0]] ``` diff --git a/snippets/initializeArrayWithRange.md b/snippets/initializeArrayWithRange.md index 8ea87a9c4..9c3b0c8f4 100644 --- a/snippets/initializeArrayWithRange.md +++ b/snippets/initializeArrayWithRange.md @@ -11,6 +11,6 @@ const initializeArrayWithRange = (end, start = 0) => ``` ```js -initializeArrayWithRange(5) -> [0,1,2,3,4,5] -initializeArrayWithRange(7, 3) -> [3,4,5,6,7] +initializeArrayWithRange(5) // [0,1,2,3,4,5] +initializeArrayWithRange(7, 3) // [3,4,5,6,7] ``` diff --git a/snippets/initializeArrayWithValues.md b/snippets/initializeArrayWithValues.md index a92a09e7a..a8ac57bc5 100644 --- a/snippets/initializeArrayWithValues.md +++ b/snippets/initializeArrayWithValues.md @@ -10,5 +10,5 @@ const initializeArrayWithValues = (n, value = 0) => Array(n).fill(value); ``` ```js -initializeArrayWithValues(5, 2) -> [2,2,2,2,2] +initializeArrayWithValues(5, 2) // [2,2,2,2,2] ``` diff --git a/snippets/intersection.md b/snippets/intersection.md index 0596a04ce..960433b6e 100644 --- a/snippets/intersection.md +++ b/snippets/intersection.md @@ -9,5 +9,5 @@ const intersection = (a, b) => { const s = new Set(b); return a.filter(x => s.ha ``` ```js -intersection([1,2,3], [4,3,2]) -> [2,3] +intersection([1,2,3], [4,3,2]) // [2,3] ``` diff --git a/snippets/isArmstrongNumber.md b/snippets/isArmstrongNumber.md index 65972fc88..81f59409e 100644 --- a/snippets/isArmstrongNumber.md +++ b/snippets/isArmstrongNumber.md @@ -10,7 +10,7 @@ const isArmstrongNumber = digits => ``` ```js -isArmstrongNumber(1634) -> true -isArmstrongNumber(371) -> true -isArmstrongNumber(56) -> false +isArmstrongNumber(1634) // true +isArmstrongNumber(371) // true +isArmstrongNumber(56) // false ``` diff --git a/snippets/isArray.md b/snippets/isArray.md index 28b80c262..3fa987f4f 100644 --- a/snippets/isArray.md +++ b/snippets/isArray.md @@ -9,6 +9,6 @@ const isArray = val => !!val && Array.isArray(val); ``` ```js -isArray(null) -> false -isArray([1]) -> true +isArray(null) // false +isArray([1]) // true ``` diff --git a/snippets/isBoolean.md b/snippets/isBoolean.md index ad47fa33e..3e7022df9 100644 --- a/snippets/isBoolean.md +++ b/snippets/isBoolean.md @@ -9,6 +9,6 @@ const isBoolean = val => typeof val === 'boolean'; ``` ```js -isBoolean(null) -> false -isBoolean(false) -> true +isBoolean(null) // false +isBoolean(false) // true ``` diff --git a/snippets/isDivisible.md b/snippets/isDivisible.md index 95919d69d..b7a5614f0 100644 --- a/snippets/isDivisible.md +++ b/snippets/isDivisible.md @@ -9,5 +9,5 @@ const isDivisible = (dividend, divisor) => dividend % divisor === 0; ``` ```js -isDivisible(6,3) -> true +isDivisible(6,3) // true ``` diff --git a/snippets/isEven.md b/snippets/isEven.md index b2bb58b58..2e3312309 100644 --- a/snippets/isEven.md +++ b/snippets/isEven.md @@ -10,5 +10,5 @@ const isEven = num => num % 2 === 0; ``` ```js -isEven(3) -> false +isEven(3) // false ``` diff --git a/snippets/isFunction.md b/snippets/isFunction.md index eae2073e4..d1c0a722d 100644 --- a/snippets/isFunction.md +++ b/snippets/isFunction.md @@ -9,6 +9,6 @@ const isFunction = val => val && typeof val === 'function'; ``` ```js -isFunction('x') -> false -isFunction(x => x) -> true +isFunction('x') // false +isFunction(x => x) // true ``` diff --git a/snippets/isNumber.md b/snippets/isNumber.md index 3035a0a3a..f14a608e5 100644 --- a/snippets/isNumber.md +++ b/snippets/isNumber.md @@ -9,6 +9,6 @@ const isNumber = val => typeof val === 'number'; ``` ```js -isNumber('1') -> false -isNumber(1) -> true +isNumber('1') // false +isNumber(1) // true ``` \ No newline at end of file diff --git a/snippets/isPrime.md b/snippets/isPrime.md index 2e609028b..b0d23c80e 100644 --- a/snippets/isPrime.md +++ b/snippets/isPrime.md @@ -14,6 +14,6 @@ const isPrime = num => { ``` ```js -isPrime(11) -> true -isPrime(12) -> false +isPrime(11) // true +isPrime(12) // false ``` diff --git a/snippets/isString.md b/snippets/isString.md index 923bcd174..1e0dbcef6 100644 --- a/snippets/isString.md +++ b/snippets/isString.md @@ -9,6 +9,6 @@ const isString = val => typeof val === 'string'; ``` ```js -isString(10) -> false -isString('10') -> true +isString(10) // false +isString('10') // true ``` diff --git a/snippets/isSymbol.md b/snippets/isSymbol.md index 0baa68500..a0ae667eb 100644 --- a/snippets/isSymbol.md +++ b/snippets/isSymbol.md @@ -9,6 +9,6 @@ const isSymbol = val => typeof val === 'symbol'; ``` ```js -isSymbol('x') -> false -isSymbol(Symbol('x')) -> true +isSymbol('x') // false +isSymbol(Symbol('x')) // true ``` diff --git a/snippets/last.md b/snippets/last.md index f26427591..3dd1cf680 100644 --- a/snippets/last.md +++ b/snippets/last.md @@ -9,5 +9,5 @@ const last = arr => arr[arr.length - 1]; ``` ```js -last([1,2,3]) -> 3 +last([1,2,3]) // 3 ``` diff --git a/snippets/lcm.md b/snippets/lcm.md index cc9b32367..ec98e26b7 100644 --- a/snippets/lcm.md +++ b/snippets/lcm.md @@ -13,5 +13,5 @@ const lcm = (x,y) => { ``` ```js -lcm(12,7) -> 84 +lcm(12,7) // 84 ``` diff --git a/snippets/median.md b/snippets/median.md index e472e7c0d..77ec63fdf 100644 --- a/snippets/median.md +++ b/snippets/median.md @@ -13,6 +13,6 @@ const median = arr => { ``` ```js -median([5,6,50,1,-5]) -> 5 -median([0,10,-2,7]) -> 3.5 +median([5,6,50,1,-5]) // 5 +median([0,10,-2,7]) // 3.5 ``` diff --git a/snippets/negate.md b/snippets/negate.md index 739ad97c1..fd8856b2f 100644 --- a/snippets/negate.md +++ b/snippets/negate.md @@ -9,6 +9,6 @@ const negate = func => (...args) => !func(...args); ``` ```js -filter([1, 2, 3, 4, 5, 6], negate(isEven)) -> [1, 3, 5] -negate(isOdd)(1) -> false +filter([1, 2, 3, 4, 5, 6], negate(isEven)) // [1, 3, 5] +negate(isOdd)(1) // false ``` diff --git a/snippets/nthElement.md b/snippets/nthElement.md index ba2d1933e..9c1fbf387 100644 --- a/snippets/nthElement.md +++ b/snippets/nthElement.md @@ -11,6 +11,6 @@ const nthElement = (arr, n=0) => (n>0? arr.slice(n,n+1) : arr.slice(n))[0]; ``` ```js -nthElement(['a','b','c'],1) -> 'b' -nthElement(['a','b','b'],-3) -> 'a' +nthElement(['a','b','c'],1) // 'b' +nthElement(['a','b','b'],-3) // 'a' ``` diff --git a/snippets/objectFromPairs.md b/snippets/objectFromPairs.md index 2ed208f44..5066ff528 100644 --- a/snippets/objectFromPairs.md +++ b/snippets/objectFromPairs.md @@ -9,5 +9,5 @@ const objectFromPairs = arr => arr.reduce((a, v) => (a[v[0]] = v[1], a), {}); ``` ```js -objectFromPairs([['a',1],['b',2]]) -> {a: 1, b: 2} +objectFromPairs([['a',1],['b',2]]) // {a: 1, b: 2} ``` diff --git a/snippets/objectToPairs.md b/snippets/objectToPairs.md index 6ea5fc051..6d73bc93b 100644 --- a/snippets/objectToPairs.md +++ b/snippets/objectToPairs.md @@ -9,5 +9,5 @@ const objectToPairs = obj => Object.keys(obj).map(k => [k, obj[k]]); ``` ```js -objectToPairs({a: 1, b: 2}) -> [['a',1],['b',2]]) +objectToPairs({a: 1, b: 2}) // [['a',1],['b',2]]) ``` diff --git a/snippets/orderBy.md b/snippets/orderBy.md index ab5581dc3..48c1d1172 100644 --- a/snippets/orderBy.md +++ b/snippets/orderBy.md @@ -21,6 +21,6 @@ const orderBy = (arr, props, orders) => ```js const users = [{ 'name': 'fred', 'age': 48 },{ 'name': 'barney', 'age': 36 }, { 'name': 'fred', 'age': 40 },{ 'name': 'barney', 'age': 34 }]; -orderby(users, ['name', 'age'], ['asc', 'desc']) -> [{name: 'barney', age: 36}, {name: 'barney', age: 34}, {name: 'fred', age: 48}, {name: 'fred', age: 40}] -orderby(users, ['name', 'age']) -> [{name: 'barney', age: 34}, {name: 'barney', age: 36}, {name: 'fred', age: 40}, {name: 'fred', age: 48}] +orderby(users, ['name', 'age'], ['asc', 'desc']) // [{name: 'barney', age: 36}, {name: 'barney', age: 34}, {name: 'fred', age: 48}, {name: 'fred', age: 40}] +orderby(users, ['name', 'age']) // [{name: 'barney', age: 34}, {name: 'barney', age: 36}, {name: 'fred', age: 40}, {name: 'fred', age: 48}] ``` diff --git a/snippets/palindrome.md b/snippets/palindrome.md index 820162617..f6c8f4204 100644 --- a/snippets/palindrome.md +++ b/snippets/palindrome.md @@ -13,5 +13,5 @@ const palindrome = str => { ``` ```js -palindrome('taco cat') -> true +palindrome('taco cat') // true ``` diff --git a/snippets/percentile.md b/snippets/percentile.md index 5287521b0..92a9d2eab 100644 --- a/snippets/percentile.md +++ b/snippets/percentile.md @@ -10,5 +10,5 @@ const percentile = (arr, val) => ``` ```js -percentile([1,2,3,4,5,6,7,8,9,10], 6) -> 55 +percentile([1,2,3,4,5,6,7,8,9,10], 6) // 55 ``` diff --git a/snippets/pick.md b/snippets/pick.md index 0bfeba286..f59ff2ba6 100644 --- a/snippets/pick.md +++ b/snippets/pick.md @@ -10,5 +10,5 @@ const pick = (obj, arr) => ``` ```js -pick({ 'a': 1, 'b': '2', 'c': 3 }, ['a', 'c']) -> { 'a': 1, 'c': 3 } +pick({ 'a': 1, 'b': '2', 'c': 3 }, ['a', 'c']) // { 'a': 1, 'c': 3 } ``` diff --git a/snippets/pipe.md b/snippets/pipe.md index a7c271afe..58b606c4c 100644 --- a/snippets/pipe.md +++ b/snippets/pipe.md @@ -13,5 +13,5 @@ const pipeFunctions = (...fns) => fns.reduce((f, g) => (...args) => g(f(...args) const add5 = x => x + 5 const multiply = (x, y) => x * y const multiplyAndAdd5 = pipeFunctions(multiply, add5) -multiplyAndAdd5(5, 2) -> 15 +multiplyAndAdd5(5, 2) // 15 ``` diff --git a/snippets/powerset.md b/snippets/powerset.md index dc91406e9..3e1651174 100644 --- a/snippets/powerset.md +++ b/snippets/powerset.md @@ -10,5 +10,5 @@ const powerset = arr => ``` ```js -powerset([1,2]) -> [[], [1], [2], [2,1]] +powerset([1,2]) // [[], [1], [2], [2,1]] ``` diff --git a/snippets/primes.md b/snippets/primes.md index c8b64f1e5..87ac21a70 100644 --- a/snippets/primes.md +++ b/snippets/primes.md @@ -15,5 +15,5 @@ const primes = num => { ``` ```js -primes(10) -> [2,3,5,7] +primes(10) // [2,3,5,7] ``` diff --git a/snippets/promisify.md b/snippets/promisify.md index 4769fa5e9..f4a414cc1 100644 --- a/snippets/promisify.md +++ b/snippets/promisify.md @@ -18,5 +18,5 @@ const promisify = func => ```js const delay = promisify((d, cb) => setTimeout(cb, d)) -delay(2000).then(() => console.log('Hi!')) -> // Promise resolves after 2s +delay(2000).then(() => console.log('Hi!')) // // Promise resolves after 2s ``` diff --git a/snippets/pull.md b/snippets/pull.md index 52e0f3ea6..153732ffd 100644 --- a/snippets/pull.md +++ b/snippets/pull.md @@ -19,9 +19,9 @@ const pull = (arr, ...args) => { ```js let myArray1 = ['a', 'b', 'c', 'a', 'b', 'c']; pull(myArray1, 'a', 'c'); -console.log(myArray1) -> [ 'b', 'b' ] +console.log(myArray1) // [ 'b', 'b' ] let myArray2 = ['a', 'b', 'c', 'a', 'b', 'c']; pull(myArray2, ['a', 'c']); -console.log(myArray2) -> [ 'b', 'b' ] +console.log(myArray2) // [ 'b', 'b' ] ``` diff --git a/snippets/pullAtIndex.md b/snippets/pullAtIndex.md index bd7472567..459c2c7b2 100644 --- a/snippets/pullAtIndex.md +++ b/snippets/pullAtIndex.md @@ -21,6 +21,6 @@ const pullAtIndex = (arr, pullArr) => { let myArray = ['a', 'b', 'c', 'd']; let pulled = pullAtIndex(myArray, [1, 3]); -console.log(myArray); -> [ 'a', 'c' ] -console.log(pulled); -> [ 'b', 'd' ] +console.log(myArray); // [ 'a', 'c' ] +console.log(pulled); // [ 'b', 'd' ] ``` diff --git a/snippets/pullAtValue.md b/snippets/pullAtValue.md index 97a59a0ed..ff2559a53 100644 --- a/snippets/pullAtValue.md +++ b/snippets/pullAtValue.md @@ -20,6 +20,6 @@ const pullAtValue = (arr, pullArr) => { ```js let myArray = ['a', 'b', 'c', 'd']; let pulled = pullAtValue(myArray, ['b', 'd']); -console.log(myArray); -> [ 'a', 'c' ] -console.log(pulled); -> [ 'b', 'd' ] +console.log(myArray); // [ 'a', 'c' ] +console.log(pulled); // [ 'b', 'd' ] ``` diff --git a/snippets/randomHexColorCode.md b/snippets/randomHexColorCode.md index a40f129e2..5009e1977 100644 --- a/snippets/randomHexColorCode.md +++ b/snippets/randomHexColorCode.md @@ -9,7 +9,7 @@ const randomHexColorCode = () => '#'+(Math.random()*0xFFFFFF<<0).toString(16); ``` ```js -randomHexColorCode() -> "#e34155" -randomHexColorCode() -> "#fd73a6" -randomHexColorCode() -> "#4144c6" +randomHexColorCode() // "#e34155" +randomHexColorCode() // "#fd73a6" +randomHexColorCode() // "#4144c6" ``` diff --git a/snippets/randomIntegerInRange.md b/snippets/randomIntegerInRange.md index e8fd26077..95e9383aa 100644 --- a/snippets/randomIntegerInRange.md +++ b/snippets/randomIntegerInRange.md @@ -9,5 +9,5 @@ const randomIntegerInRange = (min, max) => Math.floor(Math.random() * (max - min ``` ```js -randomIntegerInRange(0, 5) -> 2 +randomIntegerInRange(0, 5) // 2 ``` diff --git a/snippets/randomNumberInRange.md b/snippets/randomNumberInRange.md index 53d60b16d..b249c0e51 100644 --- a/snippets/randomNumberInRange.md +++ b/snippets/randomNumberInRange.md @@ -9,5 +9,5 @@ const randomNumberInRange = (min, max) => Math.random() * (max - min) + min; ``` ```js -randomNumberInRange(2,10) -> 6.0211363285087005 +randomNumberInRange(2,10) // 6.0211363285087005 ``` diff --git a/snippets/readFileLines.md b/snippets/readFileLines.md index 1939a78cd..66afab87f 100644 --- a/snippets/readFileLines.md +++ b/snippets/readFileLines.md @@ -18,5 +18,5 @@ contents of test.txt : line3 ___________________________ let arr = readFileLines('test.txt') -console.log(arr) // -> ['line1', 'line2', 'line3'] +console.log(arr) // // ['line1', 'line2', 'line3'] ``` diff --git a/snippets/remove.md b/snippets/remove.md index 78be3257b..8d41ac5b7 100644 --- a/snippets/remove.md +++ b/snippets/remove.md @@ -14,5 +14,5 @@ const remove = (arr, func) => ``` ```js -remove([1, 2, 3, 4], n => n % 2 == 0) -> [2, 4] +remove([1, 2, 3, 4], n => n % 2 == 0) // [2, 4] ``` diff --git a/snippets/repeatString.md b/snippets/repeatString.md index 2d892b506..2f66bb047 100644 --- a/snippets/repeatString.md +++ b/snippets/repeatString.md @@ -11,6 +11,6 @@ const repeatString = (str="",num=2) => { ``` ```js -repeatString("abc",3) -> 'abcabcabc' -repeatString("abc") -> 'abcabc' +repeatString("abc",3) // 'abcabcabc' +repeatString("abc") // 'abcabc' ``` diff --git a/snippets/reverseString.md b/snippets/reverseString.md index 2fe9cdd0b..d34aac630 100644 --- a/snippets/reverseString.md +++ b/snippets/reverseString.md @@ -10,5 +10,5 @@ const reverseString = str => str.split('').reverse().join(''); ``` ```js -reverseString('foobar') -> 'raboof' +reverseString('foobar') // 'raboof' ``` diff --git a/snippets/round.md b/snippets/round.md index 9c6b55f2c..8ece6dcd1 100644 --- a/snippets/round.md +++ b/snippets/round.md @@ -10,5 +10,5 @@ const round = (n, decimals=0) => Number(`${Math.round(`${n}e${decimals}`)}e-${de ``` ```js -round(1.005, 2) -> 1.01 +round(1.005, 2) // 1.01 ``` diff --git a/snippets/runPromisesInSeries.md b/snippets/runPromisesInSeries.md index 9719ed6aa..d45b00d07 100644 --- a/snippets/runPromisesInSeries.md +++ b/snippets/runPromisesInSeries.md @@ -10,5 +10,5 @@ const runPromisesInSeries = ps => ps.reduce((p, next) => p.then(next), Promise.r ```js const delay = (d) => new Promise(r => setTimeout(r, d)) -runPromisesInSeries([() => delay(1000), () => delay(2000)]) -> //executes each promise sequentially, taking a total of 3 seconds to complete +runPromisesInSeries([() => delay(1000), () => delay(2000)]) // //executes each promise sequentially, taking a total of 3 seconds to complete ``` diff --git a/snippets/sample.md b/snippets/sample.md index 078542224..8a5dc3292 100644 --- a/snippets/sample.md +++ b/snippets/sample.md @@ -10,5 +10,5 @@ const sample = arr => arr[Math.floor(Math.random() * arr.length)]; ``` ```js -sample([3, 7, 9, 11]) -> 9 +sample([3, 7, 9, 11]) // 9 ``` diff --git a/snippets/select.md b/snippets/select.md index c3db1e047..1c6ff462f 100644 --- a/snippets/select.md +++ b/snippets/select.md @@ -11,5 +11,5 @@ const select = (from, selector) => ```js const obj = {selector: {to: {val: 'val to select'}}}; -select(obj, 'selector.to.val'); -> 'val to select' +select(obj, 'selector.to.val'); // 'val to select' ``` diff --git a/snippets/shallowClone.md b/snippets/shallowClone.md index cdef28d9b..2eed68a58 100644 --- a/snippets/shallowClone.md +++ b/snippets/shallowClone.md @@ -11,5 +11,5 @@ const shallowClone = obj => Object.assign({}, obj); ```js const a = { x: true, y: 1 }; const b = shallowClone(a); -a === b -> false +a === b // false ``` diff --git a/snippets/shuffle.md b/snippets/shuffle.md index 00b434d77..593167984 100644 --- a/snippets/shuffle.md +++ b/snippets/shuffle.md @@ -9,5 +9,5 @@ const shuffle = arr => arr.sort(() => Math.random() - 0.5); ``` ```js -shuffle([1,2,3]) -> [2,3,1] +shuffle([1,2,3]) // [2,3,1] ``` diff --git a/snippets/similarity.md b/snippets/similarity.md index e1f735be2..6a3c89b38 100644 --- a/snippets/similarity.md +++ b/snippets/similarity.md @@ -9,5 +9,5 @@ const similarity = (arr, values) => arr.filter(v => values.includes(v)); ``` ```js -similarity([1,2,3], [1,2,4]) -> [1,2] +similarity([1,2,3], [1,2,4]) // [1,2] ``` diff --git a/snippets/sortCharactersInString.md b/snippets/sortCharactersInString.md index 4e7e68cf7..8bdc6bcce 100644 --- a/snippets/sortCharactersInString.md +++ b/snippets/sortCharactersInString.md @@ -10,5 +10,5 @@ const sortCharactersInString = str => ``` ```js -sortCharactersInString('cabbage') -> 'aabbceg' +sortCharactersInString('cabbage') // 'aabbceg' ``` diff --git a/snippets/speechSynthesis.md b/snippets/speechSynthesis.md index 2ccb55375..74a628795 100644 --- a/snippets/speechSynthesis.md +++ b/snippets/speechSynthesis.md @@ -16,5 +16,5 @@ const speechSynthesis = message => { ``` ```js -speechSynthesis('Hello, World') -> // plays the message +speechSynthesis('Hello, World') // // plays the message ``` diff --git a/snippets/spreadOver.md b/snippets/spreadOver.md index d41b1cb36..3c26506c1 100644 --- a/snippets/spreadOver.md +++ b/snippets/spreadOver.md @@ -10,6 +10,6 @@ const spreadOver = fn => argsArr => fn(...argsArr); ```js const arrayMax = spreadOver(Math.max) -arrayMax([1,2,3]) -> 3 -arrayMax([1,2,4]) -> 4 +arrayMax([1,2,3]) // 3 +arrayMax([1,2,4]) // 4 ``` diff --git a/snippets/standardDeviation.md b/snippets/standardDeviation.md index 43d7139fd..0bddc99e8 100644 --- a/snippets/standardDeviation.md +++ b/snippets/standardDeviation.md @@ -17,6 +17,6 @@ const standardDeviation = (arr, usePopulation = false) => { ``` ```js -standardDeviation([10,2,38,23,38,23,21]) -> 13.284434142114991 (sample) -standardDeviation([10,2,38,23,38,23,21], true) -> 12.29899614287479 (population) +standardDeviation([10,2,38,23,38,23,21]) // 13.284434142114991 (sample) +standardDeviation([10,2,38,23,38,23,21], true) // 12.29899614287479 (population) ``` diff --git a/snippets/symmetricDifference.md b/snippets/symmetricDifference.md index 6879edb39..a26a4db4a 100644 --- a/snippets/symmetricDifference.md +++ b/snippets/symmetricDifference.md @@ -12,5 +12,5 @@ const symmetricDifference = (a, b) => { ``` ```js -symmetricDifference([1,2,3], [1,2,4]) -> [3,4] +symmetricDifference([1,2,3], [1,2,4]) // [3,4] ``` diff --git a/snippets/tail.md b/snippets/tail.md index 69983d169..cc7fb6130 100644 --- a/snippets/tail.md +++ b/snippets/tail.md @@ -9,6 +9,6 @@ const tail = arr => arr.length > 1 ? arr.slice(1) : arr; ``` ```js -tail([1,2,3]) -> [2,3] -tail([1]) -> [1] +tail([1,2,3]) // [2,3] +tail([1]) // [1] ``` diff --git a/snippets/take.md b/snippets/take.md index 07d25262d..d8257f54f 100644 --- a/snippets/take.md +++ b/snippets/take.md @@ -9,6 +9,6 @@ const take = (arr, n = 1) => arr.slice(0, n); ``` ```js -take([1, 2, 3], 5) -> [1, 2, 3] -take([1, 2, 3], 0) -> [] +take([1, 2, 3], 5) // [1, 2, 3] +take([1, 2, 3], 0) // [] ``` diff --git a/snippets/takeRight.md b/snippets/takeRight.md index 45d272ed0..13b8d47ed 100644 --- a/snippets/takeRight.md +++ b/snippets/takeRight.md @@ -9,6 +9,6 @@ const takeRight = (arr, n = 1) => arr.slice(arr.length - n, arr.length); ``` ```js -takeRight([1, 2, 3], 2) -> [ 2, 3 ] -takeRight([1, 2, 3]) -> [3] +takeRight([1, 2, 3], 2) // [ 2, 3 ] +takeRight([1, 2, 3]) // [3] ``` diff --git a/snippets/timeTaken.md b/snippets/timeTaken.md index b687edecf..15941c6b0 100644 --- a/snippets/timeTaken.md +++ b/snippets/timeTaken.md @@ -12,6 +12,6 @@ const timeTaken = callback => { ``` ```js -timeTaken(() => Math.pow(2, 10)) -> 1024 +timeTaken(() => Math.pow(2, 10)) // 1024 (logged): timeTaken: 0.02099609375ms ``` diff --git a/snippets/toCamelCase.md b/snippets/toCamelCase.md index 3b0621050..130c1c4d5 100644 --- a/snippets/toCamelCase.md +++ b/snippets/toCamelCase.md @@ -15,8 +15,8 @@ const toCamelCase = str => { ``` ```js -toCamelCase("some_database_field_name") -> 'someDatabaseFieldName' -toCamelCase("Some label that needs to be camelized") -> 'someLabelThatNeedsToBeCamelized' -toCamelCase("some-javascript-property") -> 'someJavascriptProperty' -toCamelCase("some-mixed_string with spaces_underscores-and-hyphens") -> 'someMixedStringWithSpacesUnderscoresAndHyphens' +toCamelCase("some_database_field_name") // 'someDatabaseFieldName' +toCamelCase("Some label that needs to be camelized") // 'someLabelThatNeedsToBeCamelized' +toCamelCase("some-javascript-property") // 'someJavascriptProperty' +toCamelCase("some-mixed_string with spaces_underscores-and-hyphens") // 'someMixedStringWithSpacesUnderscoresAndHyphens' ``` diff --git a/snippets/toDecimalMark.md b/snippets/toDecimalMark.md index 4a2716c0a..b670622cd 100644 --- a/snippets/toDecimalMark.md +++ b/snippets/toDecimalMark.md @@ -7,5 +7,5 @@ const toDecimalMark = num => num.toLocaleString("en-US"); ``` ```js -toDecimalMark(12305030388.9087) -> "12,305,030,388.9087" +toDecimalMark(12305030388.9087) // "12,305,030,388.9087" ``` diff --git a/snippets/toEnglishDate.md b/snippets/toEnglishDate.md index 1d600c808..974bdcc02 100644 --- a/snippets/toEnglishDate.md +++ b/snippets/toEnglishDate.md @@ -11,5 +11,5 @@ const toEnglishDate = (time) => ``` ```js -toEnglishDate('09/21/2010') -> '21/09/2010' +toEnglishDate('09/21/2010') // '21/09/2010' ``` diff --git a/snippets/toKebabCase.md b/snippets/toKebabCase.md index 50b7ead16..b1782726f 100644 --- a/snippets/toKebabCase.md +++ b/snippets/toKebabCase.md @@ -13,9 +13,9 @@ const toKebabCase = str => ``` ```js -toKebabCase("camelCase") -> 'camel-case' -toKebabCase("some text") -> 'some-text' -toKebabCase("some-mixed_string With spaces_underscores-and-hyphens") -> 'some-mixed-string-with-spaces-underscores-and-hyphens' -toKebabCase("AllThe-small Things") -> "all-the-small-things" -toKebabCase('IAmListeningToFMWhileLoadingDifferentURLOnMyBrowserAndAlsoEditingSomeXMLAndHTML') -> "i-am-listening-to-fm-while-loading-different-url-on-my-browser-and-also-editing-xml-and-html" +toKebabCase("camelCase") // 'camel-case' +toKebabCase("some text") // 'some-text' +toKebabCase("some-mixed_string With spaces_underscores-and-hyphens") // 'some-mixed-string-with-spaces-underscores-and-hyphens' +toKebabCase("AllThe-small Things") // "all-the-small-things" +toKebabCase('IAmListeningToFMWhileLoadingDifferentURLOnMyBrowserAndAlsoEditingSomeXMLAndHTML') // "i-am-listening-to-fm-while-loading-different-url-on-my-browser-and-also-editing-xml-and-html" ``` diff --git a/snippets/toOrdinalSuffix.md b/snippets/toOrdinalSuffix.md index 53541c162..bf0f19227 100644 --- a/snippets/toOrdinalSuffix.md +++ b/snippets/toOrdinalSuffix.md @@ -16,5 +16,5 @@ const toOrdinalSuffix = num => { ``` ```js -toOrdinalSuffix("123") -> "123rd" +toOrdinalSuffix("123") // "123rd" ``` diff --git a/snippets/toSnakeCase.md b/snippets/toSnakeCase.md index d978e7abc..be27970a9 100644 --- a/snippets/toSnakeCase.md +++ b/snippets/toSnakeCase.md @@ -13,10 +13,10 @@ const toSnakeCase = str =>{ ``` ```js -toSnakeCase("camelCase") -> 'camel_case' -toSnakeCase("some text") -> 'some_text' -toSnakeCase("some-javascript-property") -> 'some_javascript_property' -toSnakeCase("some-mixed_string With spaces_underscores-and-hyphens") -> 'some_mixed_string_with_spaces_underscores_and_hyphens' -toSnakeCase("AllThe-small Things") -> "all_the_smal_things" -toSnakeCase('IAmListeningToFMWhileLoadingDifferentURLOnMyBrowserAndAlsoEditingSomeXMLAndHTML') -> "i_am_listening_to_fm_while_loading_different_url_on_my_browser_and_also_editing_some_xml_and_html" +toSnakeCase("camelCase") // 'camel_case' +toSnakeCase("some text") // 'some_text' +toSnakeCase("some-javascript-property") // 'some_javascript_property' +toSnakeCase("some-mixed_string With spaces_underscores-and-hyphens") // 'some_mixed_string_with_spaces_underscores_and_hyphens' +toSnakeCase("AllThe-small Things") // "all_the_smal_things" +toSnakeCase('IAmListeningToFMWhileLoadingDifferentURLOnMyBrowserAndAlsoEditingSomeXMLAndHTML') // "i_am_listening_to_fm_while_loading_different_url_on_my_browser_and_also_editing_some_xml_and_html" ``` diff --git a/snippets/truncateString.md b/snippets/truncateString.md index 56561cc7f..66fc5d855 100644 --- a/snippets/truncateString.md +++ b/snippets/truncateString.md @@ -11,5 +11,5 @@ const truncateString = (str, num) => ``` ```js -truncateString('boomerang', 7) -> 'boom...' +truncateString('boomerang', 7) // 'boom...' ``` diff --git a/snippets/truthCheckCollection.md b/snippets/truthCheckCollection.md index a2c4cb35e..4a8aa7e14 100644 --- a/snippets/truthCheckCollection.md +++ b/snippets/truthCheckCollection.md @@ -9,5 +9,5 @@ const truthCheckCollection = (collection, pre) => (collection.every(obj => obj[p ``` ```js -truthCheckCollection([{"user": "Tinky-Winky", "sex": "male"}, {"user": "Dipsy", "sex": "male"}], "sex") -> true +truthCheckCollection([{"user": "Tinky-Winky", "sex": "male"}, {"user": "Dipsy", "sex": "male"}], "sex") // true ``` diff --git a/snippets/union.md b/snippets/union.md index d141d2a3e..155fbd7c4 100644 --- a/snippets/union.md +++ b/snippets/union.md @@ -9,5 +9,5 @@ const union = (a, b) => Array.from(new Set([...a, ...b])); ``` ```js -union([1,2,3], [4,3,2]) -> [1,2,3,4] +union([1,2,3], [4,3,2]) // [1,2,3,4] ``` diff --git a/snippets/validateNumber.md b/snippets/validateNumber.md index 075e6b4f9..70840cf88 100644 --- a/snippets/validateNumber.md +++ b/snippets/validateNumber.md @@ -11,5 +11,5 @@ const validateNumber = n => !isNaN(parseFloat(n)) && isFinite(n) && Number(n) == ``` ```js -validateNumber('10') -> true +validateNumber('10') // true ``` diff --git a/snippets/without.md b/snippets/without.md index 044f2e8f6..594ea2edd 100644 --- a/snippets/without.md +++ b/snippets/without.md @@ -11,5 +11,5 @@ const without = (arr, ...args) => arr.filter(v => !args.includes(v)); ``` ```js -without([2, 1, 2, 3], 1, 2) -> [3] +without([2, 1, 2, 3], 1, 2) // [3] ``` diff --git a/snippets/words.md b/snippets/words.md index 47d70659d..3d8097da7 100644 --- a/snippets/words.md +++ b/snippets/words.md @@ -10,6 +10,6 @@ const words = (str, pattern = /[^a-zA-Z-]+/) => str.split(pattern).filter(Boolea ``` ```js -words("I love javaScript!!") -> ["I", "love", "javaScript"] -words("python, javaScript & coffee") -> ["python", "javaScript", "coffee"] +words("I love javaScript!!") // ["I", "love", "javaScript"] +words("python, javaScript & coffee") // ["python", "javaScript", "coffee"] ``` diff --git a/snippets/zip.md b/snippets/zip.md index 1d3a9080d..92613ff34 100644 --- a/snippets/zip.md +++ b/snippets/zip.md @@ -16,6 +16,6 @@ const zip = (...arrays) => { ``` ```js -zip(['a', 'b'], [1, 2], [true, false]); -> [['a', 1, true], ['b', 2, false]] -zip(['a'], [1, 2], [true, false]); -> [['a', 1, true], [undefined, 2, false]] +zip(['a', 'b'], [1, 2], [true, false]); // [['a', 1, true], ['b', 2, false]] +zip(['a'], [1, 2], [true, false]); // [['a', 1, true], [undefined, 2, false]] ``` diff --git a/snippets/zipObject.md b/snippets/zipObject.md index a9ea71146..99d134ac8 100644 --- a/snippets/zipObject.md +++ b/snippets/zipObject.md @@ -9,6 +9,6 @@ const zipObject = ( props, values ) => props.reduce( ( obj, prop, index ) => ( o ``` ```js -zipObject(['a','b','c'], [1,2]) -> {a: 1, b: 2, c: undefined} -zipObject(['a','b'], [1,2,3]) -> {a: 1, b: 2} +zipObject(['a','b','c'], [1,2]) // {a: 1, b: 2, c: undefined} +zipObject(['a','b'], [1,2,3]) // {a: 1, b: 2} ```