Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save almcarvalho/1dcd16d70e6d01b52c89fb96eaeb54d4 to your computer and use it in GitHub Desktop.
Save almcarvalho/1dcd16d70e6d01b52c89fb96eaeb54d4 to your computer and use it in GitHub Desktop.
Declaring a vector in Javascript
let valores = [5];
valores = [0, 1, 2, 3, 4]
console.log('valores');
for (let index = 0; index < valores.length; index++) {
const element = valores[index];
console.log(element);
}
let cores = Array(5);
cores = [0, 1, 2, 3, 4]
console.log('cores');
for (let index = 0; index < cores.length; index++) {
const element = cores[index];
console.log(element);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment