- The difference between an array and an object in a Delete operation
Delete operations are performed on an array, and the effect differs from the delete operation on the object;
- Delete operations differ between objects and arrays
- Delete the properties of an object first
- var originobj={name: ' Spark ', inner:{top: ' Shirt ',short: ' T-string '};
- Delete Originobj.inner;
- for (var prop in originobj) {
- ? document.write (prop);
- }
- Name
- Delete the index of an array
- array=[1,2,3];
- delete array[1];
- document.write (array);
- 1,,3
?
- Note Points for the setinterval ()/settimeout () function
For the SetInterval () and SetTimeout () functions, you need to be aware of the first parameter--the JS code in the form of a string, whose scope is global! It is therefore invalid to use the method as follows!
- function imgslide () {
- ?? pic=document. getElementById (' slide '); window. setinterval (' Pic.src=change () ', 1000);
- }
In function Imgslide (), SetInterval () invokes the PIC variable, but if the variable is declared in the function setinterval () cannot be called successfully because the first parameter of the SetInterval () code is scoped to the global/outermost layer, i.e. If a variable is used in code, the variable must be a global variable, regardless of where the setinterval () method is called.
- How to use JS to manipulate CSS classes for DOM objects
- When adding classes and removing classes to HTML tags on existing classes with JS, you can use the Split method only to remove the first element (the label's original class name) and add and remove it!
- Element.classname=element.classname.split ("") [0]+ " wrong";
Notable points in JavaScript (1)