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

270
Visualizações
Identifier expected error with multi line string

enter image description here

I'm working with node , trying to build jupyter notebooks programatically. I'm trying to create a function that will build a notebook 'code' type cell. After working in the repl I have:

function codeCell(arr =>  
  `{
  cell_type: 'code',
  execution_count: null,
  metadata: { tags: [] },
  outputs: [],
  source: [${arr}]
}`
);

As you can see in the screenshot I'm getting an identifier expected error. What am I doing wrong?

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

0

function codeCell(arr =>  

You started defining an arrow function inside the argument list of a function definition, which is invalid syntax.

Either write

function codeCell(arr) {
  return `{
    cell_type: 'code',
    execution_count: null,
    metadata: { tags: [] },
    outputs: [],
    source: [${arr}]
  }`;
}

Or if you want to use the arrow function syntax:

const codeCell = (arr) => `{
  cell_type: 'code',
  execution_count: null,
  metadata: { tags: [] },
  outputs: [],
  source: [${arr}]
}`;
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