ALL


  Deep clone of JavaScript object

In JavaScript world, it's frequently seen object clone. Normally when creating a clone of an object, it's only the reference being cloned but not all contents. In some scenarioes, it's desired to clone all the content instead of just the reference such that any change made to the cloned object will not change the original object.Differences between shallow clone and deep clone can be as simple as:Shallow clone : Only the object reference is cloned but not the contentDeep clone : Clone all content, including the content of the object referenced in the objectShallow clone implementationIt's rela...

11,284 0       JAAVSCRIPT SHALLOW COPY DEEP CLONE DEEP COPY SHALLOW CLONE


  One thought about JavaScript exception handle

Due to network, browser and cache issues, the JS executed in production may produce different results from the testing environments. Sometimes they may produce exceptions. Front-end developers may encounter this kind of exceptions frequently. But how to log and use them is seldomly considered by them. Actually, exception handling includes two steps : log and use.1. LogRegarding to log error, this is relatively convenient, since in each browser, there is one interface called window.onerror.window.onerror =function(errorMessage, scriptURL, lineNumber){ alert(errorMessage, scriptURL, lineNumber)...

2,321 0       EMAIL LOG EXCEPTION JAAVSCRIPT