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
// In this challenge you are given two stings. You must take the letters from both strings and list them in a spacific order. | |
// I've extracted the letters, counted instances and filtered out ones not required. I am left with an array such as this. | |
// Each element of the array contains three values. | |
// [ 1, 2, 3 ]: | |
// 1. The number of the string that had the most of that letter. If both strings had the same number then an '=' is used. | |
// 2. The letter. | |
// 3. The number of instances that letter occured. | |
const arrayToSort = [ [ '2', 'b', 4 ], | |
[ '=', 'd', 2 ], | |
[ '2', 'f', 2 ], |
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
function insertContent(results) { | |
let content = document.getElementById('inserted-content'); | |
results.forEach(function(res) { | |
content.innerHTML += ` | |
<div class="total-insert"> | |
<div class="header-content"> | |
<h1>This is the title</h1> | |
<div class="more-info"> //perhaps append data-thing-id="${res.id}" |
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
import React, { useState, useEffect } from "react" | |
import { get } from "lodash" | |
import useCallbackOnStateChange from "../lib/useCallbackOnStateChange" | |
const SomeComponent = ({ locationData }) => { | |
const [isGrid, setIsGrid] = useState(() => | |
get(locationData, "state.isGrid", false) | |
) | |
const [counter, setCounter] = useState(0) |