I'VE TRIED EVERYTHING CAN SOMEONE SOLVE THIS PLEASE!!
I TRIED TO PUT THIS IN AT FIRST BUT IT KEEPS FAILING
SO I TRIED THIS BUT IT STILL DOESN'T WORK
I GOT THIS ERROR MESSAGE
plate Given a string value word, set the lastWord variable to: • the upper-cased string stored in word if the word starts with the letter p and has a length of 10 • the unmodified string stored in word if it is any other number or does not start with a p Examples index.js 1 let word = 'carrots'; 2 // let word = 'pacific'; 3 // let word = 'perfecto'; // let word = 'perfect'; 5 // let word = 'perfection'; 4 6 if word is 'puzzlingly', lastWord should be reassigned to 'PUZZLINGLY. (starts with p, has 10 characters) 7 let lastword; 8 9 // YOUR CODE let word = 'puzzlingly'; // reassign lastWord to PUZZLINGLY 10 11 12 13 // DO NOT EDIT BELOW if word is 'pavonazzos', lastWord should be reassigned to 'PAVONAZZOS. (starts with p, has 10 characters) 14 15 module.exports = {word, lastWord}; 16 let word = 'pavonazzos'; // reassign lastWord to 'PAVONAZZOS' CONSOLE SHELL if word is 'pacific', lastWord should be reassigned to 'pacific'. (starts with p, but only has 7 characters) let word = 'pacific'; // reassign lastWord to 'pacific'
D let lastword; 6 7 8 9 10 11 let word = "puzzlingly"; let lastword; 12 = 10) { 1 13 14 15 16 17 18 19 20 if (word[0] 'p' && word.length lastword = word. toupperCase() } else{ lastword = word; } console.log(lastword)
umbe Perfection (0/2 Points) Failed A mple { Summary: rd is ZLIN SyntaxError: /usercode/index.js: Identifier 'word' has already bee n declared. (9:4) wor reas rd i > AVO 7 | let lastWord; 8 9 | let word = "puzzlingly"; | 10 | let lastword; 11 | 12 | if (word[0] == 'p' && word.length == wor reas 10) { rd is fic'. (starts with p, but only has 7 characters) - word = 'pacific':
6 let lastword; 7 8 — 9 10 == 10) { 11 12 if (word[0] == 'p' && word.length lastword = word.toUpperCase() } else { lastword = word; } 13 14 15 16 17 18 19 20 console.log(lastword)
Perfection (0/2 Points) Failed ^ Summary: FAIL ./index.test.js lastWord X should be of type string (5 ms) X should be uppercased if word starts with p and has length of 10 (1 ms) • lastWord > should be of type string expect (received) .toEqual (expected) // deep equality
Perfection (0/2 Points) Failed ^ Summary: Expected: "string" Received: "undefined" 5L 6 7 it('should be of type string', () => { expect (typeof lastWord).toEqual ('string'); }); 8 9L
e un mbe Perfection (0/2 Points) Failed A nple Summary: -di ELIN at Object.<anonymous> (index.test.js:7:29) Wor reas • lastWord > should be uppercased if word starts with p and has leng th of 10 -di expect (received) .toEqual (expected) // deep equality AVON Expected: "carrots" Received: undefined wor reas -dis
I'VE TRIED EVERYTHING CAN SOMEONE SOLVE THIS PLEASE!! I TRIED TO PUT THIS IN AT FIRST BUT IT KEEPS FAILING SO I TRIED TH
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am