• Using built-in objects Math.random Realize Guessing Number Game


    function getRandom(min,max){ return Math.floor ( Math.random () * (max min + 1)) + min; / / get the random integer between two numbers, including the two values penetrated by the real parameter. } var random = getRandom(1,10);   For (VaR I = 1; I < = 10; I + +) {/ / for loop traversal, declaring […]

  • When to use uselayouteffect?


    1、 AboutuseLayoutEffectDescription of This is described in the reactjs documentuseLayoutEffect: The signature is identical to useEffect, but it fires synchronously after all DOM mutations only differs in when it is fired NamelyuseLayoutEffectWithuseEffectThe function signature is the same, but it is triggered synchronously after DOM modification, which is the same asuseEffectThe only difference. 2、 When to […]

  • From DFS to visitor mode


    1、 Walk and visit thought Here, we use an intuitive real-world example to illustrate the idea of walk and visit 1. A metaphor We assume that there is such a community, the houses in the community are independent villas. The organizational form of this community is a little strange. It is organized in a tree […]

  • JavaScript guess number game


    Code implementation: Document //Functions that generate random integers function getRandom(min, max) { return Math.floor(Math.random() * (max – min + 1)) + min; } //Get random integers from 1 to 50 var random = getRandom(1, 50); var flag = 0; //Dead loop. If you run out of 5 chances or guess right, you will exit the […]

  • Ruffian scale embedded: several suggestions on how to consult the master effectively in the workplace


    –The stone rockery of Suzhou Museum Hello, everyone. I’m a ruffian. I’m a real technical ruffian. Today, ruffian Heng doesn’t talk about technology. He talks with everyone casually. In recent years, with the deepening of his qualifications (accompanied by the decrease of his distribution), he has also brought many fresh students / interns. At the […]

  • The mystery of promise function then


    Promise’s then method can accept the execution result of the previous function and guarantee the sequential execution of the other promise. How can this be done? Schematic diagram (above) Problem demand How to ensure the sequential execution of multiple promises?example: var f1 = function (){ return new Promise(function (resolve, reject){ setTimeout(function (){ console.log(“f1 ok!”) resolve(“f1 […]

  • Interesting HTTP header information


    Original address: https://frenxi.com/http-heade… Original author: Francesco Carlucci A few days ago, I wandered through creditkarma’s blog and found this HTTP header: X-hacker: If you’re reading this, you should visit wpvip.com/careers and apply to join the fun, mention this header. My first thought was, “Wow, in the past, we used to use millennium bug to save […]

  • I advise you not to keep accounts


    As for financial management, the first step is to keep accounts and find out your own expense list. With the list, you can sort out which flowers to spend and which to save, and then make some plans for yourself to accumulate the original funds. I just started to write down for one month, and […]