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

165
Views
Not a function TypeError when trying to split a user input inside a function

I created two functions and a global object data. I am trying to split what a person inputs inside a text area into individual strings and push them in the global object. The Error I have says userInputParam.split is not a function.For the sake of brevity I have excluded the updateUserInput function which is attached to a click event.

let data = {
  userInput: [],
  splittedInput: [],
  slicedInput: [],
};


function updateUserInput(data) {
  if (data.userInput.length == 0) {
    //   console.log("You can do this Panda!")
    data.userInput.push(input.value);
    //input.value is what a user inputs in a textarea. 
    splitUserInput(data.userInput)
  }
}

function splitUserInput (userInputParam){
    let splittedInput = userInputParam.split(/([*/+-])/)
    //console.log(splittedInput)
}
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

The argument to splitUserInput should be the input value, not the array that you pushed it onto.

splitUserInput should return the result of splitting, and then you can push that onto data.sp;littedInput.

function updateUserInput(data) {
  if (data.userInput.length == 0) {
    //   console.log("You can do this Panda!")
    data.userInput.push(input.value);
    //input.value is what a user inputs in a textarea. 
    data.splittedInput.push(splitUserInput(data.userInput));
  }
}

function splitUserInput (userInputParam){
    let splittedInput = userInputParam.split(/([*/+-])/)
    return splittedInput;
}

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!