Skip to content
Advertisement

Tag: function

Count matching letters once

I’m creating a kid’s learning tool that has a form which matches 4 letters to a word. I want to count the number of character matches in a word. But it counts duplicates of letters as 2 instead of 1. For example if the word is “loot”, and the user submits “flop”, the matching letters are 3 instead of 2,

Converting nested loops into forEach();

Im trying to learn forEach() method but i cant find more advanced examples. So i thought about refactoring my Codewars code to learn from it. I dont know know to properly use forEach method in nested loops. Hope You can help me learn from this example 🙂 6 kyu – Replace With Alphabet Position https://www.codewars.com/kata/546f922b54af40e1e90001da/train/javascript Answer (Note: @Terry’s solution is

Advertisement