• The difference between VaR and let in the for loop


    Let declaration in the for loop Before the let appears, the iteration variables defined by the for loop will penetrate outside the loopDepartment: for (var i = 0; i < 5; ++i) { //Circular logic } console.log(i); // 5 After using let instead, this problem disappears because of the role of iteration variablesThe domain is […]

  • Vue3 parent-child component value transfer when using slots


    Vue3 parent-child component value transfer when using slots For usage, see the in-depth component section of the official document, slot section: Reference documents:Slot – scope slot – slot prop Scope slot SometimesEnable slot contents to access data unique to subcomponentsIs very useful. Requirement: the slot content can access the data only in the sub component […]

  • Learning notes – Javascript scope chain


    Listening to onomori’s scope chain, I have gained a lot. When the function is declared, it will create an implicit attribute inside JS, [[scope]], and save the current scope chain. By default, the first is go. When the function is executed, it will create its own Ao, which is saved in the first place of […]

  • Intensive reading of class static block


    class-static-blockProposed on2021.9.1Entering Stage4 is a proposal based on class enhancement. This week we combineES2022 feature: class static initialization blocksThis article discusses this feature together. summary Why do we need the syntax of class static block? One reason is the need for flexible assignment of class static variables. Taking the following as an example, if we […]

  • Review JavaScript (Lesson3): scope and closure (1)


    In Lesson1’s review of let, we talked about the concept of block level scope. We learned that JS includes global scope, function scope and block level scope. This time, we will learn about the scope in detail. Amway has a good book “JavaScript you don’t know (Volume I)”. The whole first part of this book […]

  • Review JavaScript (lesson4): scope and closure (2)


    In Lesson3, we reviewed the content related to JS scope, understood JS scope, and looked at closures again, which was very easy. 1. Concept of closure Let’s add a knowledge point first (ps: if you don’t think it’s easy to understand, let’s look at the code later ~). Lexical scope: “the execution of a function […]

  • C language – constants / variables


    catalogue constant variable Scope of variable Memory analysis of variables   constant Definition: describes some fixed data that cannot be changed Classification of constants: integer constants Binary octal number system hexadecimal Real constant Single precision float Double precision double character constant char string constant Enclosed in double quotation marks is a string constant #include int […]

  • C++ Basics – classes and objects (2)


    C++ – classes and objects (2) – inheritance inherit A little introduction There are special relationships between some classes, as shown in the following figure: When defining these classes, the subordinate members not only have the commonalities of the upper class, but also have their own characteristics. At this time, the inheritance technology can be […]

  • ES6 variable mechanism


    JS defines variables in the following three common ways var foo = 1; let data = 2; const arr = []; Special way function aa () {} import aa from “aa” class AA {} Variable promotion and function promotion Function promotion will be promoted to the top priority, but if the later variable name is […]

  • C# program is prohibited from repeated startup


    Commonly, process is used to get the process and judge whether the program has been started Getprocessesbyname, the following is a note to record the use of mutexes to judge. “Onlyone” is the name (ID) of the customized system Mutex. Its scope is system level, that is, if other programs also need to prohibit repeated […]

  • ES6 function expansion


    Function parameter setting default value Parametric deconstruction Parameter default value location undefined rest Name attribute Arrow function () => {} Can save (a, b) = > A + B The scope of this is the object where it is defined (special) Cannot instantiate an object with new as a constructor Cannot be a generator function, […]

  • The difference between the naming specification of front-end JS and let, VaR and Const


    Naming conventions Naming conventions1. Hard requirements1) cannot start with a number2) it can contain numbers, letters, underscores and hyphens 2. For soft requirements, please see the name and meaning Naming methodName of 1 hump (recommended)     LinWen 2. Name of small hump    linWen 3 snake nomenclature    lin_wen 4 Hungarian nomenclature Array a_myUser Function Fu_doSch Object O_person […]