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

108
Views
Shifting split text array

I'm having an issue to shift a split text array

let text = "Hello world";

console.log(text.split(" ").shift()) // Hello

It gives me Hello instead of world

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

This is because the Array.prototype.shift() function removes the first element of the array as expected AND returns it. That's why you get "Hello". To get "world", you need to do text[1] .

Have a great day, Lukas Laudrain.

See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/shift

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!