javascript

I wrote a simple firefox extension: only one content script which has only one line of code: console.log(“hello world”); I was confident it was all right. Then, I typed “about:debugging” […]

How to define a Javascript object? The key of an object can be an identifier/symbol(an identifier is a continuous alphabeta/number/_ that does not begin with a number), a number, or […]

firefox extension console log

When you are debugging your javascript code(so called page script) of your website, you may use console.log to write the value of a variable to console. You can press F12, […]

When browser starts to load a web page, document.readyState===loading. When DOM is constructed, document.readyState==interactive. When page is fully loaded, i.e., the images/css are all loaded, document.readyState===complete. After document.readyState becomes interactive, […]

I have a need to remove multiple lines except the first line in a string. For example, “line1\n\line2\nline3” should be converted to “line1”. At the beginning, I used the following […]