1. Introduce the basic data type of JS
Undefined,Null,Boolean,number,String
What are the built-in objects for 2.js?
Data encapsulation Class object: Object, Array, Boolean, number, and String
Other objects: Function, Arguments, Math, Date, REGEXP, Error
understanding of 3.this objects
This always points to the direct caller of the function (not the indirect caller);
If there is a new keyword, this points to the new object;
In the event, this points to the object that triggered the event, and, in particular, the this in the attachevent in IE always points to the Global object window;
What
does 4.eval do?
Its function is to parse the corresponding string into JS code and run;
You should avoid using eval, unsafe, very performance-consuming (2 times, parsing into JS statements at a time, executing once).
You can use Eval,var obj =eval (' (' + str + ') to convert a JSON string to a JSON object);
5.DOM How to add, remove, move, copy, create, and find nodes
//Create a new node createdocumentfragment ()// Create a DOM fragment createelement () Create a concrete element createTextNode () //// Add, remove, replace, insert appendchild () removechild () ReplaceChild () insertbefore () //// find getElementsByTagName () //// The value of the Name property of the element (ie is more tolerant, Will get an array that includes the ID equals the name value) getElementById () // by Element ID, Uniqueness
What
is the difference between 6.null and undefined?
Null is an object that represents "none", and a value of 0;undefined is a primitive value that represents "none", and a value of Nan when converted to a number. Undefined
(1) The variable is declared, but when it is not assigned, it is equal to undefined.
(2) when calling a function, the argument that should be supplied is not provided, which equals undefined.
(3) The object does not have an assigned property, and the value of this property is undefined.
(4) When the function does not return a value, undefined is returned by default. Null:
(1) As a function parameter, the parameter of the function is not an object.
(2) As the end point of the object prototype chain.
what exactly did the 7.new operator do ?
(1) An empty object is created, and the this variable references the object and also inherits the prototype of the function.
(2) The properties and methods are added to the object referenced by this.
(3) The newly created object is referenced by this and the last implicitly returns this.
8.JSON of understanding?
JSON (JavaScript Object Notation) is a lightweight data interchange format. It is based on a subset of JavaScript. Data format is simple, easy to read and write, occupy small bandwidth.
Format: Use key-value pairs, for example: {' age ': ' + ', ' name ': ' Back '}
9.call () and apply () The difference and role?
The Apply () function has two parameters: the first argument is the context, and the second parameter is an array of arguments. If the context is null, the global object is used instead.
such as: Function.apply (this,[1,2,3]);
The first parameter of call () is the context, followed by the sequence of arguments passed in by the instance.
such as: Function.call (this,1,2,3);
10. How do I get UA?
function Whatbrowser () { document. Browser.name.value=navigator.appname; Document. Browser.version.value=navigator.appversion; Document. Browser.code.value=Navigator.appcodename; Document. Browser.agent.value=navigator.useragent;}
Basic question--javascript