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

203
Views
Tampermonkey JavaScript Global Variable Issue

My issue is that the tempEmail and tempPass are different. Any suggestions to make it static, so the values never change? I have tried using "let" and "var". This has been made with TamperMonkey javascript. Any help would be appreciated. I am not calling it twice? I don't see why they would have different values. (when i print tempEmail and tempPass at different times, they have different valuyes (??)) I have also tried making tempEmail + tempPass const.

// ==UserScript==
// @name         Test
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://*/*
// @grant window.close
// @grant window.focus
// @grant GM_setValue
// ==/UserScript==

const domains = ["@gmail.com", "@hotmail.com", "@outlook.com"];
var username = makeid(getRandomInt(6, 12));
var email = username + domains[Math.floor(Math.random() * domains.length)];
var password = makeid(5);

var tempEmail = email;
var tempPass = password;

function sendMessage() {
        console.log(tempEmail + ":" + tempPass);
    }

function makeid(length) {
        var result = '';
        var characters = 'abcdefghijklmnopqrstuvwxyz0123456789';
        var charactersLength = characters.length;
        for (var i = 0; i < length; i++) {
            result += characters.charAt(Math.floor(Math.random() *
                charactersLength));
        }
        return result;
    }

  

(function() {
    'use strict';
    if (/SIGN UP WITH YOUR EMAIL/i.test(document.body.innerHTML)) {
        // My automation code here to sign up on the web site.

    } 
})();
about 4 years ago · Juan Pablo Isaza
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!