Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

261
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!