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

160
Views
exporting function return value

I have a code below

function createRoom(){

  $(document).keyup(function(event) {
      if ($("#room_name").is(":focus") && event.key == "Enter") {
        var plainText = document.querySelector(".create-room-class").value;
        var createRoomName = plainText.replace(/(<([^>]+)>)/gi, "");
        createRoomName = createRoomName.replace(/ +/g, "");
        createRoomName = createRoomName.trim();
        if(createRoomName.length == 0){
            alert("empty");
        } else if(createRoomName.length < 5){
            alert("Room name must be equal or longer than 5 characters");
        } else if(!createRoomName.length == 0)
        {
          getCreatedRoomName(createRoomName);
          window.location = createRoomName;
        }
      }
  });

}

createRoom();

function getCreatedRoomName(x){
  return x;
}

What it does is first checks if input field is not empty and if not smaller than 5 characters. If everything is fine then we pass that value to a function and then redirect to that created name url. Look below.

  getCreatedRoomName(createRoomName);
  window.location = createRoomName;

And we return value (return x)

function getCreatedRoomName(x){
  return x;
}

How can I retrieve that returned value in nodejs? I tried modules it doesn't work for some reason.

about 4 years ago · Santiago Trujillo
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!