2
Good night. I’m having trouble going through an array within another array, I’d like to select the user by the technology they use, in the CSS case. If there’s any way someone can give me a logic to understand and continue my studies. Thank you! Follow the program I’m doing, if someone has tips to improve, I’m still learning so excuse any mistake!
const usuarios = [
{ nome: 'Carlos', tecnologias: ['HTML', 'CSS'] },
{ nome: 'Jasmine', tecnologias: ['JavaScript', 'CSS'] },
{ nome: 'Tuane', tecnologias: ['HTML', 'Node.js'] }
]
function users(usuarios) {
let i = 0
for (let i = 0; i < usuarios.length; i++) {
console.log(`${usuarios[i].nome} trabalho com ${usuarios[i].tecnologias}.`)
}
}
function checaSeUsuarioUsaCSS(usuario) {
usuario.Usacss = false
if (usuarios.tecnologias == "css"){
usuario.Usacss = true
}
}
for (let i = 0; i < usuarios.length; i++) {
const usuarioTrabalhaComCSS = checaSeUsuarioUsaCSS(usuarios[i])
if (usuarioTrabalhaComCSS) {
console.log(`O usuário ${usuario[i].nome} trabalha com CSS`)
}
}
console.table(usuarios)
checaSeUsuarioUsaCSS(usuarios)
users(usuarios)
Only that function
checaSeUsuarioUsaCSS()
is enough to be a solution?– Augusto Vasques
I believe yes, would it be necessary more? I modified the program a lot trying to find some solution and got lost, in case there was a
– Prometheus
I was preparing an answer, https://repl.it/repls/HideousShadySmalltalk, but if you have already solved your doubt. Do what? :)
– Augusto Vasques
Thanks for your help, I’ll look at your code
– Prometheus