Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

192
Visualizações
What do i input in the Matrix element constructor to fill the matrix?
    export class Matrix {

    constructor(...m) {
        console.log(...m);
        this.m = new Array(16).fill(0).splice(0, m.length, ...m);
    }

    toArray() {
        return [...this.m];
    }

    toString() {
        return `(${this.m.join(',')})`;
    }
    negate(){

    }
}
const mtrx = new Matrix(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16);

This is the constructor my teacher gave me, how can I call this constructor and put elements inside? ...m means any array but I cant find the right syntax online. If i call it how i did i get a matrix full of 0.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

What worked is just simply doing this:

this.m = new Array(16).fill(0);
this.m.splice(0, m.length, ...m);

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda