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

224
Views
How to push text value into array

I am looking for a JavaScript push method to add value into array, in the style of:

title = document.getElementById('tit').value;
description = document.getElementById('desc').value;
if (localStorage.getItem('itemJson') == null) {
    itemJsonArray = [];
    itemJsonArray.push([title, description]);
    localStorage.setItem('itemJson', JSON.stringify(itemJsonArray));
}
about 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Just Use The Following Code To Add A Text To An Array Using Something Like This:

title = "First Element"
itemJsonArray = [];
itemJsonArray.push(title);
about 4 years ago · Santiago Trujillo Report

0

You can push multiple elements to the javascript array by using the below steps.

const arr = [];

arr.push('title', 'description');
console.log(arr); // 👉️ ['title', 'description']

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