furthered work

This commit is contained in:
2024-10-03 11:29:13 -05:00
parent fa7ac2949b
commit 1e756f4f72
15 changed files with 301 additions and 93 deletions

View File

@ -1,51 +1,51 @@
A function that takes a number from 0 to 5 and returns the
English word for that number. For example, 1 should return "one".
Hint: use an array to define the mapping from numbers to
strings.
<html><body><script>
function numdict (numb) {
dict = {
0 : "Zero",
1 : "One",
2 : "Two",
3 : "Three",
4 : "Four",
5 : "Five"
}
word = dict[numb]
console.log(word)
return word
}
let numberdictionary = function (numb) {
dict = {
0 : "Zero",
1 : "One",
2 : "Two",
3 : "Three",
4 : "Four",
5 : "Five"
}
word = dict[numb]
console.log(word)
return word
}
let nd = (numb) => {
dict = {
0 : "Zero",
1 : "One",
2 : "Two",
3 : "Three",
4 : "Four",
5 : "Five"
}
word = dict[numb]
console.log(word)
return word
}
numdict(1)
numberdictionary(2)
nd(3)
A function that takes a number from 0 to 5 and returns the
English word for that number. For example, 1 should return "one".
Hint: use an array to define the mapping from numbers to
strings.
<html><body><script>
function numdict (numb) {
dict = {
0 : "Zero",
1 : "One",
2 : "Two",
3 : "Three",
4 : "Four",
5 : "Five"
}
word = dict[numb]
console.log(word)
return word
}
let numberdictionary = function (numb) {
dict = {
0 : "Zero",
1 : "One",
2 : "Two",
3 : "Three",
4 : "Four",
5 : "Five"
}
word = dict[numb]
console.log(word)
return word
}
let nd = (numb) => {
dict = {
0 : "Zero",
1 : "One",
2 : "Two",
3 : "Three",
4 : "Four",
5 : "Five"
}
word = dict[numb]
console.log(word)
return word
}
numdict(1)
numberdictionary(2)
nd(3)
</script></body></html>