• Interview handwritten code list


    Anti chattering function const debounce = (fn, wait) => { let _ = ” return (…arg) => { clearTimeout(_) _ = setTimeout(() => { fn.apply(this, arg) }, wait) } } input.addEventListener(“input”, debounce(ajax, 1000)); Throttling function const throttle = (fn, s) => { let a = +new Date(), _ return (…arg) => { let b = +new Date() – a if (b > s) { _ = setTimeout(() => { fn(arg); _ = ” }, s) a = +new Date() } } } input.addEventListener(“input”, throttle(ajax, 1000)); Deep copy (solve circular reference) function clone(target, map = new WeakMap()) { if (typeof target === ‘object’) { let cloneTarget = Array.isArray(target) ? [] : […]

  • 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; […]

  • No service wasm, wasm reference, wasm runtime – webassembly weekly 0902


    To join the webassembly Chinese group, please go to the end of the article Editor’s note: there’s a lot of webassembly news this week! WebAssembly Serverless Rust + WebAssembly This article shows you how to use rust + webassembly to create server less applications for machine learning and data visualization. embed-wasm Embedded wasm crite allows […]

  • Warm cold “spring” front-end interview questions come


    Coordinates: Shenzhen Objective: to improve the technology Topics may be biased toward technical management and architects Handwritten source code (written on paper, scan generated code to run directly) I think it’s very necessary. The human eye can judge whether JS code is running wrong or not. The ability to eliminate bugs is the key. Handwritten […]

  • React — Redux


    1、 How to use Redux The use of Linux is similar to that of usereducer (please seeRe learning react — context / reducer(one article) // store.ts import { createStore, applyMiddleware, combineReducers } from ‘redux’; Import logger from ‘Redux logger’; // Middleware Import chunk from ‘Redux chunk’; // Middleware export interface IState { name: string, age: […]

  • Es9 (2)—— Promise.finally


    catalog How to operate promise? Want to know all about promise? Es6-learning landscape How to operate promise? usePromise.finally, regardless of executionthenstillcatchWill be implementedfinallyThe body of functions inside. For example, a pop-up window can be usedresolveandrejectSave the values of the variables separately,But in the endfinallyTo control the pop-up window. Here’s an example of the code: const […]

  • Jsliang job series – 08 – handwritten promise


    Interviewer: write one by handPromise, requires implementationresolve()/reject()/then()…… Table of contents What’s the difference between the front-end and salted fish catalog Table of contents Two myths Three simplified handwritten promise Promise five Promise.all () six Promise.race () Seven promise asynchronous scheduler 8 references Two myths Back to catalog In the evolution of asynchronous scheme in javascript: […]

  • IOS share extension custom sharing interface


    First of all, the effect picture is too ugly by default. Search the user-defined interface of share extension. Most articles will guide you to use nsextensionprincipalclass, then inherit uiviewcontroller, and then all the handwritten code. But I want to use storyboard! It’s very simple You don’t need to change the nsensionprincipalclass, just continue to use […]

  • Vue.js -Handwritten implementation of a simple two-way data binding


    Two way data binding is almost the most we hear about in Vue. V-model is our most common bidirectional data binding instruction. So how does it work? Let’s write it together. <body> <input type=’text’> <span class=’ppp’></span> </body> <script> let obj = {}; let temp; let ipt = document.querySelector(‘input’); ipt.oninput = function(){ obj.a = ipt.value; } […]

  • [mybatis] comparison between mybatis and Hibernate


    1. The difference between mybatis and Hibernate 1.1 table comparison function MyBatis Hibernate Development speed Easy to use Relatively difficult to master development effort Handwritten SQL statement You can also write SQL statements, but it breaks hibernate encapsulation and simplicity Expansibility Because it is handwritten SQL, all scalability is good, but migration is poor Database […]

  • Handwritten letter recognition based on Python three layer full connection layer


    First use the simplest three-layer fully connected neural network, then add the activation layer to view the experimental results, and finally add batch standardization to verify whether it is effective Firstly, the network structure SimpleNet is defined according to the existing template, named as net.py import torch from torch.autograd import Variable import numpy as np […]

  • Promise from two eyes to light (1) – Preparation


    Bravo! Young Xia, I’m surprised at your bones. I’d like to present this secret script. I wish you success in cultivating immortals as soon as possible! To explore promise, let’s do some warm-up work and clarify several concepts Function object and instance object Function object: using functions as objects Instance object: the object generated by […]