|
2167 | 2167 |
|
2168 | 2168 | 95. ### What is the difference between an attribute and a property
|
2169 | 2169 |
|
2170 |
| - Attributes are defined on the HTML markup whereas properties are defined on the DOM. For example, the below HTML element has 2 attributes type and value, |
| 2170 | + Attributes are defined on the HTML markup whereas properties are defined on the DOM. For example, the below HTML element has 2 attributes: `type` and `value`, |
2171 | 2171 |
|
2172 | 2172 | ```javascript
|
2173 | 2173 | <input type="text" value="Name:">
|
2174 | 2174 | ```
|
2175 | 2175 |
|
2176 |
| - You can retrieve the attribute value as below, |
| 2176 | + You can retrieve the attribute value as below, for example after typing "Good morning" into the input field: |
2177 | 2177 |
|
2178 | 2178 | ```javascript
|
2179 | 2179 | const input = document.querySelector("input");
|
|
2190 | 2190 |
|
2191 | 2191 | **[⬆ Back to Top](#table-of-contents)**
|
2192 | 2192 |
|
2193 |
| -96. ### What is same-origin policy |
| 2193 | +97. ### What is same-origin policy |
2194 | 2194 |
|
2195 | 2195 | The same-origin policy is a policy that prevents JavaScript from making requests across domain boundaries. An origin is defined as a combination of URI scheme, hostname, and port number. If you enable this policy then it prevents a malicious script on one page from obtaining access to sensitive data on another web page using Document Object Model(DOM).
|
2196 | 2196 |
|
2197 | 2197 | **[⬆ Back to Top](#table-of-contents)**
|
2198 | 2198 |
|
2199 |
| -97. ### What is the purpose of void 0 |
| 2199 | +98. ### What is the purpose of void 0 |
2200 | 2200 |
|
2201 | 2201 | Void(0) is used to prevent the page from refreshing. This will be helpful to eliminate the unwanted side-effect, because it will return the undefined primitive value. It is commonly used for HTML documents that use href="JavaScript:Void(0);" within an `<a>` element. i.e, when you click a link, the browser loads a new page or refreshes the same page. But this behavior will be prevented using this expression.
|
2202 | 2202 | For example, the below link notify the message without reloading the page
|
|
2209 | 2209 |
|
2210 | 2210 | **[⬆ Back to Top](#table-of-contents)**
|
2211 | 2211 |
|
2212 |
| -98. ### Is JavaScript a compiled or interpreted language |
| 2212 | +99. ### Is JavaScript a compiled or interpreted language |
2213 | 2213 |
|
2214 | 2214 | JavaScript is an interpreted language, not a compiled language. An interpreter in the browser reads over the JavaScript code, interprets each line, and runs it. Nowadays modern browsers use a technology known as Just-In-Time (JIT) compilation, which compiles JavaScript to executable bytecode just as it is about to run.
|
2215 | 2215 |
|
2216 | 2216 | **[⬆ Back to Top](#table-of-contents)**
|
2217 | 2217 |
|
2218 |
| -99. ### Is JavaScript a case-sensitive language |
| 2218 | +100. ### Is JavaScript a case-sensitive language |
2219 | 2219 |
|
2220 | 2220 | Yes, JavaScript is a case sensitive language. The language keywords, variables, function & object names, and any other identifiers must always be typed with a consistent capitalization of letters.
|
2221 | 2221 |
|
2222 | 2222 | **[⬆ Back to Top](#table-of-contents)**
|
2223 | 2223 |
|
2224 |
| -100. ### Is there any relation between Java and JavaScript |
| 2224 | +101. ### Is there any relation between Java and JavaScript |
2225 | 2225 |
|
2226 | 2226 | No, they are entirely two different programming languages and have nothing to do with each other. But both of them are Object Oriented Programming languages and like many other languages, they follow similar syntax for basic features(if, else, for, switch, break, continue etc).
|
2227 | 2227 |
|
|
0 commit comments