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

260
Views
¿Por qué el valor de mi variable (totalSubs) no cambia permanentemente con la nueva asignación después de la función runSubs?

Cuando se vuelve a cargar la página, totalSubs vuelve a su valor original de 10. ¿Por qué?

 var totalSubs = 10; window.onload = function getSubs() { document.getElementById('subsNo').textContent= totalSubs; } function runSubs() { var subsNo = Number(document.getElementById('subsNo').textContent); var NewSubsNo = 0; NewSubsNo = subsNo + 1; document.getElementById('subsNo').textContent= NewSubsNo; return NewSubsNo; } totalSubs = runSubs(totalSubs); <input type="submit" value="Subscribe" style="width:200px; height:60px; font-size: 2.0rem;" onclick="runSubs()" onload="getSubs()" /> <p id="subsNo"> </p>

back-end:

 var http = require('http'); var fs = require('fs'); http.createServer(function (req, res) { fs.readFile('MobileUI.html', function(err, data) { res.writeHead(200, {'Content-Type': 'text/html'}); res.write(data); return res.end(); }); }).listen(8080);
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Guárdelo en el almacenamiento local de un navegador web. Actualmente, está almacenando en la memoria temporal, así que en su lugar, use el almacenamiento local.

 localStorage.setItem('totalSub', 10); const getSub = local.getItem('totalSub')
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!