What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-10-23 16:52:08
putting a loop into an array javascript
let array = ['Item 1', 'Item 2', 'Item 3']; // Here's 4 different ways for (let index = 0; index < array.length; index++) { console.log(array[index]); } for (let index in array) { console.log(array[index]); } for (let value of array) { console... Add solution -
Javascript 2021-10-20 21:48:05
iterate array javascript
let array = ['Item 1', 'Item 2', 'Item 3']; // Here's 4 different ways for (let index = 0; index < array.length; index++) { console.log(array[index]); } for (let index in array) { console.log(array[index]); } for (let value of array) { console... Add solution -
Javascript 2021-10-19 05:38:10
reactjs typeError: Cannot read property 'offsetHeight' of null
handleResize = () => { let highestSlide = 0; this.refArray.forEach(ref => { if (ref.current && highestSlide < ref.current.offsetHeight) { highestSlide = ref.current.offsetHeight; } }); }; Add solution -
Other 2021-10-08 05:19:02
Search wikipedia
// JavaScript Document let resultsList = document.getElementById('resultsList'); let searchForm = document.getElementById('searchForm'); let searchInput = document.getElementById('searchInput'); searchForm.addEventListener('submit', (e)=> { e.preven... Add solution -
Javascript 2021-10-05 18:45:05
vanilla js for each element add attribute
const linksArray = Array.from(document.querySelectorAll('section a')); // we use Array.from to transform the NodeList from querySelectorAll to an array. Needs to IE11 linksArray.forEach(linkEl => { // we search for every span and em inside the link l... Add solution -
Other 2021-10-03 14:21:03
image left rext right CodePen
<!DOCTYPE html> <html lang="en-US"> <head> <title>JavaScript Table Filter Search</title> <link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.3.1/css/bootstrap.min.css" rel=&qu... Add solution -
Other 2021-10-01 17:23:02
Complete the sock Merchant function in the editor below. It must return an integer representing the number of matching pairs of socks that are available.
function sockMerchant(n, array) { let count = 0; const seen = {}; array.forEach((item) => { if (seen[item]) { // one sock of this color was seen before, so this completes a pair seen[item] = false; count++; } else { // this is... Add solution -
Javascript 2021-10-01 04:20:04
traverse an array in javascript
let array = ['Item 1', 'Item 2', 'Item 3']; // Here's 4 different ways for (let index = 0; index < array.length; index++) { console.log(array[index]); } for (let index in array) { console.log(array[index]); } for (let value of array) { console... Add solution
Best helpers
Frank Jaeger
+5
Deverejones
+5
Saylestyler
+5
Required
+5
Paul Knight
+5
Jonjie
+5
KMC
+5
SYJ
+5
Hwsolutions
+5