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 checkIfTwoNumbersAddUp(list, x) { | |
let currentElement; | |
let currentPos = 0; | |
let next = 0; | |
let hasPair = false; | |
const loopThrough = () => { | |
if (list.length - 1 === currentPos) { | |
return; | |
} |
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
//******REFACTORED CODE*****/// | |
Going off ofmy memory of the test but I wanted to point out some improvements I would have made | |
// Instead of iterating and attaching event listeners on each path element, I would've wanted to go back and just have the click event attached to the parent and grab the target elem path from that instead. | |
const svgelem = document.querySelector('svg'); | |
svgelem.addEventListener('click', function(e){ | |
const state = e.target.getAttribute('data-state'), | |
votes = e.target.getAttribute('data-votes'), |
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
//Probably a Naive solution | |
const sortedArr = [1,2,3,7,9,15,56,76,78]; | |
function findElem(arr, n){ | |
const firstHalf = arr.slice(0, arr.length / 2), | |
secondHalf = arr.slice(arr.length / 2); | |
let arrToPass; | |
if (arr.length === 1 && arr[0] !== n){ |
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
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<style> | |
.outline { | |
fill: none; | |
stroke: #000; | |
stroke-width: 1.5px; | |
} | |
.feature { |