Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

266
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda