• Judge that two object fields are the same through JS depth


    Code: /** *Determine whether this object is of object type * @param {Object} obj */ function isObject(obj){ return Object.prototype.toString.call(obj)==='[object Object]’; }; /** *Determine whether this type is array type * @param {Array} arr */ function isArray(arr){ return Object.prototype.toString.call(arr)==='[object Array]’; }; /** *Depth compares whether two objects are the same * @param {Object} oldData * @param […]

  • JS regular expression must contain numbers, letters, special characters


    Let’s introduce that JS regular expressions must contain numbers, letters and special characters JS regular expression requirements: 1. It must contain numbers, English letters, special symbols and be greater than or equal to 8 digits 2. Special symbols include: ~! @ × $%^&* The regular expression is as follows: /^(?=.*\d)(?=.*[a-zA-Z])(?=.*[[email protected]#$%^&*])[\[email protected]#$%^&*]{8,}$/ Interpretation: Here we mainly use […]

  • Can let in JS completely replace Iife


    Preface Recently, I wrote an article about syntax of Java’s Iife pattern to explain why we write immediate execution function expressions in the current way. A few readers criticized the article for being out of date, arguing that block level scope variables introduced in ECMA 2015 made Iife obsolete. On the contrary, executing function expressions […]

  • Introduction and preliminary application of rxjs


    Preface Rxjs is a powerful reactive programming library, which provides powerful data flow composition and control capabilities, but its learning threshold has been very high. This sharing expects to interpret its use in business from some special perspectives, rather than from the API perspective. RxJS introduction Usually, the interpretation of rxjs is something like this. […]

  • Understand the parameter transfer in JS function through an example


    First look at a JS written test: var setObj=function(o){ o.name=”xiaoming”; o={}; o.name=”xiaohong”; } var p={name:”xixi”,age:24}; setObj(p); console.log(p); The answer is {Name: Xiaoming, age24}; In JavaScript, the function parameter defaults to the reference type. 1. Function transfer value type: The code example is as follows: function addNum(num){  num+=10;  return num; } var num=10; var result=addNum(num); console.log(num); […]

  • JS written test – receive get request parameter


    subject Write a JavaScript function to receive the parameters of the get request in the URL and return it as an object. For example: VAR url = “https://i.cnblogs.com/editposts.aspx? Opt = 1”. This topic has examined how JS obtains the URL as a string, as well as the string processing method. 1. Think of regularity first […]

  • How to prevent JS jitter through examples


    Preface This topic often exists at the same time with event triggers. In order to investigate whether the interviewers can comprehensively consider the implementation ideas in some specific business processes (information flow, search box input query), etc. subject In some information lists, waterfall flow is usually used to load the corresponding data when rolling one […]

  • A simple example of implementing Ajax with JS and JSON


    preparation in advance 1. Install wampserver or other similar software to build the local integrated installation environment. I installed phpstudy.2. HTML, JS, CSS and other files need to be placed in the WWW directory of PHP study, and the index page runs by default. 3、bootstrap.css Screenshot of interface: Phpstudy is very convenient to use. If […]

  • Teach you to remember JS regular expressions easily


    (recommended) JS regular knowledge point topic: / / www.jb51.net/article/139831.htm Preface Regular expression describes a pattern of string matching, which can be used to check whether a string contains a certain seed string, replace the matched substring, or extract the substring that meets a certain condition from a string. Regular expressions are text patterns that consist […]

  • Some common functional programming terms in JS


    Composition Combine two elements of a type (including functions) to generate a new element of that type: JavaScript let compose = (f, g) => a => f(g(a)) let toUpperCase = x => x.toUpperCase() let exclaim = x => x + ‘!’ let shout = compose(exclaim, toUpperCase); shout(“hello world”) // HELLO WORLD! Partial application For a […]

  • PHP combined with bootstrap and JS to realize the function of deleting, editing and searching student list


    This small project of our own will come to an end. There may be many more bugs. Excuse me Delete student function PHP: //Here is the URL from the front-end code HTML, which is obtained by $_get (see the home page for relevant HTML code and the previous blogs) If (empty ($_get [‘num ‘]) exit […]

  • Some common regular expressions in JavaScript (recommended)


    Regular expression describes a pattern of string matching, which can be used to check whether a string contains a certain seed string, replace the matched substring, or extract the substring that meets a certain condition from a string. var validateRegExp = { decmal: “^([+-]?)\\d*\\.\\d+$”, // floating point number decmal1: “^[1-9]\\d*.\\d*|0.\\d*[1-9]\\d*$”, //Positive floating point decmal2: “^-([1-9]\\d*.\\d*|0.\\d*[1-9]\\d*)$”, […]