Help

Re: When updating value in an array, I am getting extra commas... and not sure that it's still indexed properly

860 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Rose_Haft1
8 - Airtable Astronomer
8 - Airtable Astronomer

Hi there -

When I run this code, I am getting extra commas and the values are not lining up. What am I doing wrong?

let vowels = “aeiou”
let sentence = “Your bumpkin is so beautiful”

let mda=
let fullsetofzeros =
var i
var j

for (i = 0; i < vowel.length; i++) { // p1
mda[i] = 0
}

for (i= 0; i < sentence.length; i++) { // p1
fullsetofzeros.push(mda)
}

output.text( Matrix of zeroes ${fullsetofzeros} )

for (i= 0; i < vowel.length; i++) { // p1
for (j= 0; j < sentence.length; j++) { // p1
if (vowel.includes(sentence[j])) {
fullsetofzeros[i][j]= 1
}
}
}

output.text( Matrix after test ${fullsetofzeros} )

2 Replies 2

Can you provide the output you are getting and your expected output?

You declare a variable vowels with an s at the end and later reference a vowel vowel without an s at the end. Is there additional code you did not include in your post?

This is already being discussed in another thread: