Unshift method is like push method which works at the beginning of the array. This method is used to prepend one or more elements to the beginning of the array.
Tag Archives: PHP
JavaScript Basic Groups Of Dataypes
Basic Groups Of Dataypes Are
- Reference types.
- Primitive
Javascript Looping Structures
Following are looping structures in Javascript:
- For
- While
- do-while loops
APC
APC is a great operation code caching system for PHP that can help speed up your site. PHP is a dynamic server-side scripting language that needs to be parsed, compiled and executed by the server with every page request. In many cases though, the requests produce exactly the same results which means that the cloud server has to unnecessarily repeat all these steps for each of them.
This is where APC comes into play. What it does is save the PHP opcode (operation code) in the RAM memory and if requested again, executes it from there. In essence, it bypasses the parsing and compiling steps and minimizes some unnecessary loads on the cloud server.
Javascript Variable Typing
Variable typing is used to assign a number to a variable and the same variable can be assigned to a string.
Javascript Event Bubbling
JavaScript allows DOM elements to be nested inside each other. In such a case, if the handler of the child is clicked, the handler of parent will also work as if it were clicked too.
Javascript Difference Between .call() And .apply()
The function .call() and .apply() are very similar in their usage except a little difference. .call() is used when the number of the function’s arguments are known to the programmer, as they have to be mentioned as arguments in the call statement. On the other hand, .apply() is used when the number is not known. The function .apply() expects the argument to be an array.
The basic difference between .call() and .apply() is in the way arguments are passed to the function.
Javascript Closures
Closure is a locally declared variable related to a function which stays in memory when the function has returned.
Javascript window.onload and onDocumentReady
The onload function is not run until all the information on the page is loaded. This leads to a substantial delay before any code is executed.
onDocumentReady loads the code just after the DOM is loaded. This allows early manipulation of the code.
Javascript Hide Codes
For hiding JavaScript codes from old browsers:
Add “<!–” without the quotes in the code just after the <script> tag.
Add “//–>” without the quotes in the code just before the <script> tag.
Old browsers will now treat this JavaScript code as a long HTML comment. While, a browser that supports JavaScript, will take the “<!–” and “//–>” as one-line comments.