vue writes a component

I have been working on the front end for several years. As more and more projects are being done, I need to make some wheels for my own use. vue has been used for more than a year, which can be used initially. Now I want to encapsulate a cascade pop-up window by myself. Before, most of the components written in vue were used: parameter names ar ...

Posted on Thu, 17 Oct 2019 00:15:54 -0400 by sam2004

Canvas drawing a pixel wind electronic clock

The idea is to draw a number of small squares on Canvas. The first step is to realize the method of drawing small squares. First, draw a 10x10 square with a side length of 5, which can be easily completed by using two for loops. 1 for (let i = 0; i < 10; i++) { 2 for (let j = 0; j < 10; j++) { 3 context.fillRect(5 * i, 5 ...

Posted on Wed, 16 Oct 2019 21:51:01 -0400 by Tracekill

JavaScript array sorting

The sort() method is one of the most powerful array methods. Array sorting The sort() method sorts the arrays alphabetically: Example var fruits = ["Banana", "Orange", "Apple", "Mango"]; fruits.sort(); // Yes fruits Sorting elements in Inverted array The reverse() method reverses the elements in the array. You can use i ...

Posted on Wed, 16 Oct 2019 20:44:38 -0400 by viper3two

JS data copy

The copy of JS can be divided into shallow copy and deep copy: Shallow copy: if the array element is of basic type, it will copy one copy, which will not affect each other. If it is an object or an array, it will only copy the reference of the object and the array, so that no matter we modify the old and new arrays, both will change. Deep cop ...

Posted on Wed, 16 Oct 2019 18:31:37 -0400 by krox

Simple mouse movement element near big far small effect

Effect: Pre knowledge: CSS position, js map function Implementation principle: Principle of vision: objects in the distance move slowly, and objects in the vicinity move fast Implementation principle: when the mouse is moving, the product of the original location of the original div + the distance of mouse movement and z-index *Q: why take z-in ...

Posted on Wed, 16 Oct 2019 17:52:29 -0400 by dcinadr

[DailyENJS issue 12] V8 engine and JavaScript optimization skills

DailyENJS is committed to translating excellent front-end English technical articles, bringing better technical vision for technical students. V8 is Google's engine for compiling JavaScript. Firefox has its own engine called SpiderMonkey, which is very similar to, but different from, V8. We will discuss the V8 engine in this article. Some fact ...

Posted on Wed, 16 Oct 2019 17:36:38 -0400 by danjar

Several methods of traversing and filtering arrays in jquery and traversing and parsing json objects

Original link: http://www.cnblogs.com/riasky/p/3473158.html jquery grep() filter traversal array $().ready(   function(){       var array = [1,2,3,4,5,6,7,8,9];       var filterarray = $.grep(array,function(value){Return value > 5; ...

Posted on Wed, 16 Oct 2019 11:47:28 -0400 by assonitis

30 seconds of code - Array learning

Original address: https://github.com/30-seconds... permutations Generates an array of all permutations of array elements, including duplicates. For an array with length of 2, the result is returned directly; for an array with length less than 2, the original array is returned directly. For other length arrays, first use Array.prototype.reduce() ...

Posted on Wed, 16 Oct 2019 09:09:16 -0400 by nelsons

Get page relative margins

1.getBoundingClientRect() getBoundingClientRect is used to get the location collection of an element relative to the window. There are top, right, bottom, left and other attributes in the collection. let client = e.target.getBoundingClientRect(); client.width // width client.height // height client.top // Top margin (above relative viewing are ...

Posted on Wed, 16 Oct 2019 06:22:16 -0400 by mrvanjohnson

leetcode irregular brush questions -- 18. Sum of four numbers

Source: LeetCode link: https://leetcode-cn.com/problems/4sum Given a n array of N integers nums a n d a target value target, judge whether there are four elements a, b, c and D in nums, so that the value of a + b + c + d is equal to target. Find all quads that meet the conditions and are not repeated. Be careful: The answer cannot contain dupli ...

Posted on Wed, 16 Oct 2019 05:21:15 -0400 by jursten