• Interview series of pointers and quoted usage scenarios


    Let’s start with two questions What’s the difference between a pointer and a reference? When should pointers be used? When should references be used? The difference between pointer and reference Let’s first look at a piece of code int a = 1; int b = 2; int *c = nullptr; c = &a; int &d […]

  • Handwritten instanceof and new


    Handwritten instanceof Instanceof checks whether there is a prototype in the prototype chain of the target object that is the same as the prototype of the specified object, Whether two prototypes are equal or not is determined by = = = strictly equal. function myInstanceof(obj, obj2) { let proto = obj.__proto__; let prototype = obj2.prototype; […]

  • IOS strong reference


    KCPerson.h #import @interface KCPerson : NSObject @property (nonatomic,assign) int no; @end KCPerson.m #import “KCPerson.h” @implementation KCPerson -(NSString *)description{ return [NSString stringWithFormat:@”no=%i”,_no]; } @end main.m #import #import “KCPerson.h” int main(int argc, const char * argv[]) { @autoreleasepool { //strong __strong KCPerson *person1=[[KCPerson alloc]init]; __strong KCPerson *person2=person1; person1.no=1; Nslog (@ “% @”, person2); // result: no = […]

  • This point problem of timer setinterval and setTimeout in JS


    In JS, setTimeout and setinterval are both functions used for timing. The following article mainly introduces this pointing problem of setinterval and setTimeout in JS. The article introduces it in detail through examples. Friends in need can refer to it. Let’s have a look. preface JS is a single threaded language. You can set the […]

  • Data structure and algorithm — linked list


    Linked list basic First knowledge of linked list struct Node{ int data; Node * next; }; The above is the most basic structure of the linked list: a place data, a save pointer. The pointer here is just a term for C / C + +. It’s actually to index a coordinate of the next […]

  • Write the promise library according to promise / a specification


    I tried to write about it, tested it, and didn’t test it with professional testing tools I feel that the code is easy to understand, and I am poor. If there are problems in the test, please replyAddress:https://github.com/julyL/Code… (function(global) { function isFunction(val) { return typeof val == ‘function’; } function isObject(val) { return typeof val […]

  • Dependence and version of NPM


    Dependence and version of NPM In our daily development, we use centralizedpackage.jsonThe configuration file is used to maintain the configuration information (such as name, version, license and other metadata) of the project and the dependent modules Dependency type At present, it supports the following five types dependencies devDependencies peerDependencies optionalDependencies bundledDependencies/bundleDependencies Examples { “name”: “quanerp-pc-v4”, […]

  • JS prototype things you don’t know


    key word Prototype, prototype object, constructor · __proto__ , prototype, constructor , Prototype: every function has this attribute. It is emphasized here that it is a function. Ordinary objects do not have this attribute (why ordinary objects? Because everything in JS is an object, so ordinary objects do not include function objects). It points to […]

  • JavaScript call, apply and bind



  • 005 rust asynchronous programming, pin introduction


    In order to call poll on future, you need to use a special type of pin. This section describes the pin type. Some principles behind asynchrony Example 1 Source code //File SRC/ main.rs use futures::executor; async fn async_function1() { println!(“async function1 ++++ !”); } async fn async_function2() { println!(“async function2 ++++ !”); } async fn […]

  • Development and design of prototype chain and its conventional application


    Original is not easy, if you need to reprint, please contact the author or sign the author and indicate the source of the article history background In 1994, Netscape released the 0.9 version of navigator browser, which can only be used for browsing and does not have the ability to interact with visitors. Netscape urgently […]

  • Fabric.js Pit avoidance Guide (continuously updated)


    1. In groupadd(), addWithUpdate(), setCoords()The difference between It is found that,addWithUpdate()The current scale of the group will be set to 1, and the angle will be set to 0.For example, the size of the current group is 0.6 times that of the initial group (i.escale=0.6), executeaddWithUpdate()After that, the group will treat the current size asscale=1The […]