This article has participated in the third “topic writing” track of the Denver Creators Training Camp. For details, check out: Digg Project | Creators Training Camp third is ongoing, “write” to make a personal impact.

JavaScript

Introduction to Built-in Objects

☞ JavaScript: ECMAScript DOM | | BOM ☞ ECMAScript: variables, functions, data types, process control, built-in objects... ☞ objects in ☞ JS: custom objects, built-in objects, browser objects (not ECMAScript)MathObject,ArrayObject,DateObject... ☞ Learn the built-in object MDN (HTTPS://developer.mozilla.org/zh-CN/docs/Web/JavaScript)
Copy the code

MDN introduction

MDN link

The Math object

☞ provides a series of related with mathematics method or attribute (static) | instance ☞Math▌ PI fetch PI 【 attribute 】 ☞Math.random() returns greater than or equal to0Less than1☞ for the random number betweenMath.floor() rounds down, returning an integer less than the current numberMath.ceil() rounds up, returning an integer greater than the current numberMath.round() round(decimal if less than0.5, returns an integer less than the current number, if the fractional part is greater than0.5☞ Return an integer greater than the current numberMath.abs() takes absolute value (returns the absolute value of the current number, a positive integer) ☞Math☞.max() returns the maximum value of a set of values (multiple arguments can be set, but not an array)Math☞.min() returns the minimum value of a set of numbers (multiple parameters can be set at the same time, as the maximum value)MathSine (x) returns a sine trigonometric function (note: x is an Angle in radians) ☞Math☞ Cos (x) returns a cosine trigonometric function (note: the x argument is an Angle in radians)Math.pow(x,y) returns the y power of x to find a random number between any two numbersMath.floor(Math.random() * (large number - decimal +1)+ decimal);Copy the code

Static and instance members

☞ Static member:1.No constructor is required to create an object and access properties or method instance members in the object:1.You must first create the object through a constructor2.Properties or methods that are created and accessed through constructors [instance members]Copy the code

The Date object

DateIs a constructor that must passnew Date☞ Usage 1: Empty constructor to create an objectvar d = new Date(a); ☞GMT (3030 GMT)0☞ Usage two: Pass in a string in date formatvar  d = new Date("1988-8-8"☞ The number is passed invar  d = new Date(year, month[,day,time,second]);  // Year and month must be setNote: Month from0To start,0On behalf of1Month four:var d = new Date(number); ☞ Obtain the milliseconds value of the current time: d.valueof () d.gaettime ()// Recommended
    Date.now()   // The H5 new method has compatibility informationUse the methods provided by H5 to operate multimedia labelshttp://www.w3school.com.cn/html5/html5_ref_audio_video_dom.asp
Copy the code

Methods in Date

☞ Date formatting methodvar d = new Date(a); d.toString();// Convert to a string
    d.toDateString();  // Convert to a date string
    d.toTimeString();  // Convert to a time string
    d.toLocaleDateString();   // Return the local date format (different browser different effect)
    d.toLocaleTimeString();   // Return the local time format (different browser different effect)Which oLocaleString ();// Local time and date format☞ Obtain other parts of the date (grasp) d.gettseconds ()/ / for seconds
    d.getMinutes()  // Get minutes
    d.getHours()    // Get the hour
    d.getDay()      // Return the day of the week (0 means Sunday) [0,1,2,3,4,5,6]
    d.getDate()     // Returns the day of the current month
    d.getMonth()    / / returns the month (start from 0),1,2,3,4,5,6,7,8,9,10,11 [0]
    d.getFullYear()  // Return the yearTo get intoSetYou can set the self-study document except getDay, which cannot be changed to setDayhttp://www.runoob.com/js/js-obj-date.html

http://www.w3school.com.cn/jsref/jsref_obj_math.asp
Copy the code

The array object

Common methods in arrays

☞ Determine whether the variable is an arrayArray. IsArray (ary) ☞ toString ()// Convert arrays to strings, separated by commas☞ the valueOf ()// Returns the array object itself

varary = []; ary.toString() ary.valueOf(); ▌ Ary. Push () [common]// Add content returns the length of the new arrayAry.pop () [common]// Delete the last item of the array and return☞ Queue (first in, first out) ary.push() ary.shift()// Take the first element of the array and change the array length
    ary.unshift(number)   // Add a value at the beginning of the array☞ Other methods summary ◆ Reverse ()// Flip the arrayMixer concat ()// Join two numbers together to return a new arrayMixer slice (startindex endindex)// Intercepts a new array from the current arraySplice (startIndex, deletCont, options) splice(startIndex, deletCont, options)// Remove or replace some values in the arrayCome in (index [,index]), come in (index [,index]), come in ()// Return -1 if not found➤ Search for a value in the array, return the index position if found, return - if not1Return index position if found; return - if not1In pieces the Join ()// Link each element in the array to a block by a single character
Copy the code

string

☞ Property: immutability

☞ string method 1. concat() // concatenate string equivalent to + 2. Substring (start,end) // Slice (strat,end) // Slice (strat,end) // Slice (strat,end) // Slice (strat,end) // 4. Substr (start,length) // Start from the specified position, Thread thread thread thread thread thread thread thread thread thread thread thread thread thread thread thread thread thread thread thread thread thread thread thread thread thread thread thread thread thread thread thread thread thread thread thread thread thread thread thread thread thread thread thread thread thread thread thread thread thread thread thread thread thread thread thread thread thread thread thread thread thread thread thread thread thread thread thread thread thread thread thread thread thread thread thread thread thread thread ▌ ▌ ▌ ▌ ▌ ▌ ▌ ▌ ▌ ▌ ▌ ▌ ▌ ▌ ▌ ▌ ▌ ▌ ▌ ▌ ▌ ▌ ▌ ▌ ▌ ▌ ▌ ▌ ▌ ▌ ▌ ▌ ▌ ▌ ▌ ▌ ▌ ▌ ▌ ▌ ▌ ▌ ▌ ▌ ▌ ▌ ▌ ▌ ☞ // Replace a split() with b // Split a string of characters into an array with a split characterCopy the code

Past wonderful recommendation

Front-end performance optimization for actual combat

Talk about annoying regular expressions

Obtain file BLOB stream address to achieve the download function

Vue virtual DOM confused? This article will get you through the virtual DOM once and for all

Git Git

Easy to understand Git introduction

Git implements automatic push

How do I use Git in my work

Interview Recommendations

Front ten thousand literal classics – the foundation

Front swastika area – advanced section

Nodejs series and more highlights: personal homepage