Skip to content

Commit c37899b

Browse files
committed
qns: update
1 parent db3d24f commit c37899b

File tree

5 files changed

+8
-7
lines changed
  • questions
    • what-are-iterators-and-generators-and-what-are-they-used-for
    • what-are-proxies-in-javascript-used-for
    • what-are-some-common-performance-bottlenecks-in-javascript-applications
    • what-are-the-various-ways-to-create-objects-in-javascript

5 files changed

+8
-7
lines changed

questions/describe-the-difference-between-a-cookie-sessionstorage-and-localstorage/en-US.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ document.cookie = 'auth_token=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/';
7171

7272
It is a pain to read/write to cookies. `document.cookie` returns a single string containing all the key/value pairs delimited by `;` and you have to parse the string yourself. The [`js-cookie`](https://github.com/js-cookie/js-cookie) npm library provides a simple and lightweight API for reading/writing cookies in JavaScript.
7373

74-
A modern native way of accessing cookies is via the the [Cookie Store API](https://developer.mozilla.org/en-US/docs/Web/API/Cookie_Store_API) which is only available on HTTPS pages.
74+
A modern native way of accessing cookies is via the [Cookie Store API](https://developer.mozilla.org/en-US/docs/Web/API/Cookie_Store_API) which is only available on HTTPS pages.
7575

7676
```js
7777
// Set a cookie. More options are available too.

questions/what-are-iterators-and-generators-and-what-are-they-used-for/en-US.mdx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,10 +226,12 @@ for (const number of range) {
226226
Generators are well-suited for iterating over data streams, such as fetching data from an API or reading files. This example demonstrates using a generator to fetch data from an API in batches:
227227

228228
```js
229-
function* fetchDataInBatches(url, batchSize = 10) {
229+
async function* fetchDataInBatches(url, batchSize = 10) {
230230
let startIndex = 0;
231231
while (true) {
232-
const response = await fetch(`${url}?start=${startIndex}&limit=${batchSize}`);
232+
const response = await fetch(
233+
`${url}?start=${startIndex}&limit=${batchSize}`,
234+
);
233235
const data = await response.json();
234236
if (data.length === 0) break;
235237
yield data;

questions/what-are-proxies-in-javascript-used-for/en-US.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,5 +224,5 @@ Proxies in JavaScript provide a powerful and flexible way to intercept and custo
224224

225225
## Further reading
226226

227-
- [Foo](#foo)
228-
- [Bar](#bar)
227+
- [Proxy - JavaScript | MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy)
228+
- [Proxy and Reflect | JavaScript.info](https://javascript.info/proxy)

questions/what-are-some-common-performance-bottlenecks-in-javascript-applications/en-US.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,4 +183,3 @@ function throttle(func, limit) {
183183

184184
- [MDN Web Docs: Performance](https://developer.mozilla.org/en-US/docs/Web/Performance)
185185
- [Google Developers: Web Performance Optimization](https://developers.google.com/web/fundamentals/performance)
186-
- [JavaScript.info: Optimizing browser rendering](https://javascript.info/rendering)

questions/what-are-the-various-ways-to-create-objects-in-javascript/en-US.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ person.age = 30;
6262
person.greet(); // Output: Hello, my name is John and I'm 30 years old.
6363
```
6464

65-
An object with a prototype can be created by doing `Object.create(null)`.
65+
An object without a prototype can be created by doing `Object.create(null)`.
6666

6767
## ES2015 classes
6868

0 commit comments

Comments
 (0)