-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #49 from CRBM84/48-challenge-counting-letters
#48-challenge-counting-letters
- Loading branch information
Showing
2 changed files
with
25 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
############This is a comment have a nice day :) | ||
.DS_Store | ||
thumbs.db | ||
thumbs.db |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Crea una funcion llamada 'countingLetters' que admita un parámetro de tipo | ||
// string y te devuelva el largo de la palabra. Ej: 'hola' ==> 4. | ||
// NO CHAT GPT | ||
|
||
function countingLetters(value) { | ||
var result; | ||
result = value.length; | ||
return result; | ||
} | ||
|
||
var result1 = countingLetters("hola"); | ||
console.assert(result1 === 4, { result: result1, message: "Test 1 no pasado" }); | ||
|
||
var result2 = countingLetters("belen"); | ||
console.assert(result2 === 5, { result: result2, message: "Test 2 no pasado" }); | ||
|
||
var result3 = countingLetters("foo"); | ||
console.assert(typeof result3 === "number", { | ||
result: result3, | ||
message: "Test 3 no pasado", | ||
}); | ||
|
||
countingLetters("string1"); | ||
countingLetters("this is a longer string"); |