Read the HDFS directory and display the content in the file on the web page

2023-03-14  

(1) Core ECMAScrip

(2) Document object model DOM

(3) Browser object model BOM

(1)alert(msg)

Browser pops up a warning box

(2)console.log(msg)

Browser console print output information

(3)prompt(info)

Browse pop up the input box, the user can enter

​ var age =10

VAR: It is a keyword of a JS that is used to declare variables. After using this keyword to declare variables, the computer will automatically allocate memory space for variables without programmer management

Age: It is a variable name defined by a programmer.

is to apply for space in memory

Update variables: After a variable is re -assigned, its original value will be covered, and the variable value will be based on the last assignment

At the same time, multiple variables are declared: When multiple variables are declared at the same time, you only need to write a VAR, and use English commas between multiple variable names to separate

var age = 18, name = ‘Zhang San’, Sex = 2;

(1) Composed of letters, numbers, subordinates, and US dollars symbols

(2) Strictly distinguish between lower and lowercase

(3) Can’t start with numbers

(4) Can’t be keywords, retention words

(5) Variable names must be meaningful.

(6) Observing the hump naming rule

javascript is a weak type or dynamic language. This means that there is no need to declare the type of variables in advance. During the program operation, the type will be automatically determined.

For example: var age = 10; // Digital type

var areyouok = ‘Yes’; // is a string

JavaScript has a dynamic type, and also thinks that the same variables can be used as different types

isnan is used to determine whether it is non -digital, and return a value. If the number returns false, if not, it returns True

Character Type Change

Symbols used to realize functions such as copying, comparison and execution of operators

Declaration function

function function name () {

// function body code

}

Function is the keyword of the declaration function

call function

function name ();

function return value

In JavaScript, Arguments are a special attribute of the object. The Arguments object is like an array, but it is not an array. So it is called a fake array.

(1) LENGTH attribute with array

(2) Store as an indexing manner

(3) It does not have some ways of real array POP () push (), etc.

(4) Callee, quote the currently executed function.

var obj={

​ name: tom,

​ age:18,

​ fn:function{}

}

Construction function is to abstract some of the same attributes and methods in our objects and pack them into functions

Basic grammar:
function constructor name () {{

this. Properties = value

this. Method = Function () {}

}

NEW Constructive Method Name ();

Note:

(1) Construct function Name The first letter should be uppercase

(2) The constructor can return the result without Return

(3) The call function must use NEW

built -in object refers to some objects that comes with the JS language. These objects are used for developers and provided some commonly used or most basic and necessary functions (attributes and methods)

Mathis a built -in object, which has some mathematical constant attributes and mathematical function methods.Mathnot a function object.

MathFor NUMBER type. It does not support Bigint

Math.E

Euler constant is also the bottom number of natural pairs, which is about equal to

The natural number of2.718

Math.LN2

2, about

The natural number of0.693

Math.LN10

10is about2.303

Math.LOG2E

to2as the bottom

The number ofEis about1.443

Math.LOG10E

10as the bottom

The number ofEis about0.434

Math.PI

Pay rate, the ratio of a circularity and diameter, is about equal to3.14159

​ Math.abs(x)

Return to the absolute value of a number.

​ Math.floor(x)

Returns the maximum integer less than one number, that is, the value of one number is taken down.

​ Math.fround(x)

Return to the closest number of single precision floating -point types.

​ Math.max([x[, y[, …]]])

Return to the maximum value of zero to multiple values.

​ Math.min([x[, y[, …]]])

Back to the minimum value of zero to multiple values.

​ Math.pow(x, y)

Return a number of Y times of Y.

​ Math.random()

Return a pseudo -random number between 0 and 1.

​ Math.round(x)

Return to the integer after the four houses and five.

Create a JavaScriptDateinstance, this instance presents some moment in time.Dateobject is based onUnix Time Stamp, that is, the milliseconds passed through January 1, 1970.

  • If no parameters are entered, the Date constructor will create a Date object based on the current time set by the system.
  • If at least two parameters are provided, the remaining parameters will be set to 1 by default (if no DAY parameter is specified) or 0 (if there is no parameter other than DAY).

    The time of

  • JavaScript starts on January 1, 1970, with milliseconds, and consists of 86,400,000 milliseconds a day.

    The range ofDateobject is -100,000,000 days to 100,000,000 days (the millisecond value of equivalent).

  • DateObject provides unified behavior for cross -platform. Time attributes can be represented by the same moment in different systems, and if local time objects are used, it reflects local time.
  • DateObject supports multiple methods to process UTC time, and also provides methods to deal with local time accordingly. UTC, which is what we call Greenwich, refers to the world time standard in Time. Local time refers to the time set by the client computer to execute the JavaScript client.
  • Call in the form of a functionDateobject (that is, not usednewOperations) Returns a string representing the current date and time.

Date formatting:

[External chain pictures failed, the source station may have a anti-theft chain mechanism. It is recommended to save the picture and upload it directly (IMG-BWV7U05Q-1608813244285) (E: \ MarkdownPad \ Picture \ Image-20201223194316398.png)]]

javascript**Array**Object is a global object used to construct an array, and array is a high -end object similar to the list.

Create two ways to create arrays:

(1) Literal method

​ (2)new Array();

Create array

var fruits = ['Apple', 'Banana'];

console.log(fruits.length);
// 2

Access with array elements through indexes

var first = fruits[0];
// Apple

var last = fruits[fruits.length - 1];
// Banana

Like array

fruits.forEach(function (item, index, array) {
    console.log(item, index);
});
// Apple 0
// Banana 1

Add element to the end of the array

var newLength = fruits.push('Orange');
// newLength:3; fruits: ["Apple", "Banana", "Orange"]

Delete the element at the end of the array

var last = fruits.pop(); // remove Orange (from the end)
// last: "Orange"; fruits: ["Apple", "Banana"];

Delete the element of the front (head) of the array

var first = fruits.shift(); // remove Apple from the front
// first: "Apple"; fruits: ["Banana"];

Add element to the head of the array

var newLength = fruits.unshift('Strawberry') // add to the front
// ["Strawberry", "Banana"];

Find out the index of a certain element in the array

fruits.push('Mango');
// ["Strawberry", "Banana", "Mango"]

var pos = fruits.indexOf('Banana');
// 1

Delete an element through index

var removedItem = fruits.splice(pos, 1); // this is how to remove an item

// ["Strawberry", "Mango"]

Array.from()

Create a new array instance from the class object or the iterative object.

Array.isArray()

is used to determine whether a variable is an array object.

Array.of()

Create a new array instance based on a set of parameters, and support any number and type of parameters.

[External chain pictures failed, the source station may have a anti-theft chain mechanism. It is recommended to save the picture and upload it directly (IMG-7IFJBWFC-1608813244286) (E: \ MarkdownPad \ Picture \ Image-20201223201847793.png)]]

var arr=[green,blue,pink];
arr.join(-)//green-blue-pink

Basic packaging type is to pack simple data types into complex data types, so the basic data type has attributes and methods

In order to facilitate the operation of basic data types, JavaScript also provides three special reference types: String, Number, Boolean

Step:

// 1. Generate temporary variables and pack simple types into complex data types 
 var test = new string ('Andy'); 
 // 2. The character variables that are assigned to us declare 
 str = TEMP 
 // 3. Destruction of temporary variables 
 temp = null;

(1) All methods of the string will not modify the string book (the string is non -changeable), and the operation will return a new string

(2) Return character according to the position

rr.join(-)//green-blue-pink

##### strings object 

 ###### basic packaging type 

 The basic packaging type is to package simple data types into complex data types, so the basic data type has attributes and methods 

 In order to facilitate the operation of the basic data type, JavaScript also provides three special reference types: String, Number, Boolean 

 step:

// 1. Generate temporary variables and pack simple types into complex data types
var temp =new String(‘andy’);
// 2. The character variables that are assigned to us
str=temp
// 3. Destruction of temporary variables
temp =null;

(1) All methods of the string will not modify the string book (the string is non -changeable), and the operation will return a new string 

 [External chain picture transfer ... (IMG-4PBLO0VQ-1608813244287)]] 

 (2) Return character according to the location

source

Related Posts

Deep Learning Deeplearning Recommended Paper List List of Princess Scholars Recommended Learning route scoField

CAMUNDA and Spring Boot Integration (3)-Camunda Engine Properties DEMI

minimum generation tree -template scar

c# to determine whether the two pictures are consistent with two methods, Summerdream

Read the HDFS directory and display the content in the file on the web page

Random Posts

jvm tuning command-JMAP

Connect the database with ThinkPHP and test whether the connection is successful

TODOLIST’s implementation

ARP high -speed cache command

Thinkcmf any file to write vulnerabilities —- Learning records