Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

148
Vistas
I am adding javascript 0.1 but it is adding missing

I am aiming to find all combinations of a 4 digit number among the given values. But even though I set .1 increment in json it is increasing .09999999. This increment error occurs after step 2. No way could I solve it. Can anyone see where I am wrong in the code below? Have something to add?

window.onload = ()=>{

    class playSearch {




        createCombination(arr) {
    /*
    ppp => i
    atr-f => f
    atr-p => p
    
    */
            this.combination = [];
    
            for (let i = arr[0].min; i <= arr[0].max; i = i + arr[0].plus) {
            
                for (let f = arr[1].min; f <= arr[1].max; f = (f + arr[1].plus)) {
                  console.log(arr[1].plus)
                  console.log(f)
                    for (let p = arr[2].min; p <= arr[2].max; p=p+arr[2].plus) {
                      
                        for (let m = arr[3].min; m <= arr[3].max; m=m+arr[3].plus) {
                         
                            this.combination.push([i,f,p,m])
                           
                        }
                        
                    }
    
                }
                
            }
    
         
    
    
    
    
    
    
        }
    
    }
    
    
    var user = new playSearch();
    user.createCombination(
        [
            {
                "name": "ppp",
                "min": 1,
                "max": 11,
                "plus": 1
            },
    
            {
                "name": "atr-f",
                "min":10,
                "max":20,
                "plus":1/10
            },
            {
                "name":"atr-p",
                "min":1,
                "max":5,
                "plus":1
            },
            {
                "name":"min-profit",
                "min":1,
                "max":5,
                "plus":1
            }
        ]
    )
}

I couldn't understand why .0999 was added even though I added .1. The plus in the json determines the amount of increase. I'm waiting for your help. enter image description here

about 4 years ago · Santiago Gelvez
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda