Several ways of creating objects in JS

preface All objects in JavaScript are from Object; All objects from Object Prototype inherits methods and properties, which of course may be overridden. This article mainly introduces several methods of creating objects. 1. Object literal {...} Object literal is one of the most commonly used methods, which uses curly braces containin ...

Posted by Kyrst on Wed, 12 Jan 2022 08:21:39 +0100

2021-07-29 some efficient operators in JS

A new version of JavaScript will be released every year, and some operators with more convenient and efficient operations will be added. Here are some efficient magic operators. Chain operator (?) When using a property with a deep structure and it is impossible to determine that all parents must exist, we need to make a series of jud ...

Posted by xcasio on Mon, 03 Jan 2022 10:31:41 +0100

[Typescript] theory + practice code record

typescript Dynamically typed languages: errors are known only when running Statically typed languages: compilation phase 1. Advantages Provides a static type style type systemWe used babel to compile the syntax support from es6 to es10Compatible with various browsers, systems and servers 2. Why use ts? The program is easier to understand ...

Posted by Megahertza on Mon, 03 Jan 2022 05:47:09 +0100

Ant Design Pro uses qiankun micro services to configure dynamic theme colors

After using microservice, there is a problem that the theme colors of the main application and sub application are inconsistent You want to dynamically transform the theme color of the sub application through the color of the main application Ant Design Pro can be configured through config TS configure global theme color All the best methods ...

Posted by thefamouseric on Sun, 02 Jan 2022 03:59:21 +0100

Six methods of communication between Svelte components

The main challenge of designing user interfaces using components is to manage the application state on different components. Svelte provides a powerful ability to transfer data in components. "Great communication begins with connection." — Oprah Winfrey Oprah Gail Winfrey (English: Oprah Gail Winfrey, January 29, 1954 -), born in Miss ...

Posted by Traduim on Sun, 02 Jan 2022 03:48:25 +0100

"ES6" - learning notes

Compare the scope of the var and let keywords When a variable is declared with the var keyword, it is declared globally. If it is declared inside a function, it is declared locally. The let keyword behaves similarly, but has some additional functionality. When you use the let keyword to declare a variable in a code block, statement, or expres ...

Posted by Rodis on Fri, 31 Dec 2021 21:15:42 +0100

Beginner TS - basic type of TS

Basic type of TS Boolean type let isDo:boolean = true; === var isDo = true Number type let num:number = 5; === var num = 5 String type let name:string = 'mery'; === var name = 'mery' Array type let arr:number[] = [1,2,3]; === var arr =[1,2,3] let arr:Array<number> = [4,5,6]; //Array < number > is a gen ...

Posted by puja on Thu, 30 Dec 2021 14:56:47 +0100

[TypeScript] 007 type assertion

8. Type assertion Type Assertion can be used to manually specify the type of a value. grammar value as type or <type>value The former must be used in tsx syntax (ts version of jsx syntax of React), that is, the value as type. Syntax such as < foo > represents a ReactNode in tsx. In ts, in addition to representing t ...

Posted by biopv on Sat, 25 Dec 2021 15:56:16 +0100

[TypeScript] 006 - type of function

7. Type of function Function is a first-class citizen in JavaScript! Function declaration In JavaScript, there are two common ways to define functions - Function Declaration and Function Expression: // Function Declaration function sum(x, y) { return x + y; } // Function Expression let mySum = function (x, y) { return x + ...

Posted by Miri4413 on Sat, 25 Dec 2021 06:14:51 +0100

Detailed explanation of Proxy in JavaScript

Zero. IntroductionreferenceCalculation Ji Blog posts:< Detailed explanation of Proxy in JavaScript>Ruan Yifeng's< ECMAScript 6 getting started>- 15.ProxyCorrected some errors and reorganized the editing and typesetting for personal learning only.The origin of the problemvue3.0 starts Proxy instead of object Defineproperty, causing s ...

Posted by rcatal02 on Sat, 25 Dec 2021 01:54:00 +0100