WebII H2

KeeJayBe May 23rd, 2019 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //oefening 3
  2. const letterwaarden = {a:1, b:3, c:5, d:1, e:1, f:4, g:3, h:4, i:1,j:4, k:3, l:3, m:3, n:1, o:1, p:3, q:10, r:2, s:2, t:2, u:4, v:4, w:5,x:8, y:8, z:4};
  3. document.getElementById("berekenPunten").onclick = function(){
  4.     let aantalPunten = 0;
  5.     let woord = document.getElementById("woord").value;
  6.     for(letter in woord){
  7.         aantalPunten += letterwaarden[woord.charAt(letter).toLowerCase()];
  8.     }
  9.     alert(`${woord} is ${aantalPunten} punten waard`);
  10. };
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand