254 Matching Annotations
  1. Feb 2021
    1. An async function simply implies that a promise will be returned and if a promise is not returned, JavaScript will automatically wrap it in a resolved promise with the return value in that function. That would look like writing return Promise.resolve(‘hello’)
    1. [pub_2021] 5 important concepts

      1. Equality == vs. === (primitives, object "mem ref")
      2. Async JS (callbacks, promises, async/await)
      3. Error Handling (try..catch, writing defensive code)
      4. ES6 Syntax (destructuring, spread operator, string interpolation)
      5. Array Methods (map, filter, reduce, sort, some, every)
  2. Jan 2021
  3. Dec 2020
    1. хорошая библиотека для парсинга и автоматизации тестирования "вёрстки с js"

    1. const store = observable({ players: [ "Player 1", "Player 2", ], // ... }) reaction(() => JSON.stringify(store), json => { localStorage.setItem('store',json); }, { delay: 500, }); let json = localStorage.getItem('store'); if(json) { Object.assign(store, JSON.parse(json)); }
  4. Nov 2020
  5. Oct 2020
    1. suite of over 30 separate packages of React visualization primitives that fall into several categories (Figure 2). It is un-opinionated on state management, animation, and styling so it can integrate with any React codebase, and its emphasis on modularity (similar to D3) lets you keep your bundle sizes down by only using the packages you need to create your reusable chart library or a custom one-off chart.

      Short definition of visx

    2. In our research (Figure 1), we found that existing React visualization libraries are often high-level abstractions and optimized for ease of use (i.e., fewer lines of code) at the expense of expressivity. None offer the expressivity of D3 primitives and many don’t allow for the optimization we want in production because computation, animations, state management, styles, and rendering are all encapsulated.

      Comparison of data visualisation libraries:

    3. because D3 and React both want to own DOM manipulation, we’ve found that it’s best to only use D3 for the math and React for the DOM because two mental models for updating the DOM opens the door for bugs to sneak in. However, using D3 solely for math means a significant amount of its (DOM-based) functionality is not available for use: selection.join, zoom, drag, brush, and transitions. Additionally, as mentioned above, D3 has its own learning curve and we would like developers to feel like they are writing native React code with standard APIs and familiar patterns.

      You can use D3 inside a React app, but...

  6. Sep 2020
  7. Jul 2020
    1. One of the best ways is to use “promises,”
    2. function that does something asynchronously should provide a callback argument where we put the function to run after it’s complete
  8. May 2020
    1. 通常,Arrays用于两种数据结构:queue和stack。 要了解什么queue是食品,您可以想象在食品商店中有一个普通的队列:新人们在队列的末端加入队列,而刚开始的人们则先离开队列。这就是为什么我们需要两种方法来实现的原因queue:一种在的末尾添加元素,Array而另一种在的开始处删除元素的方法queue。这两种方法是push()将一个或多个元素添加到数组的末尾并返回新的数组长度,并shift()删除数组的第零个元素并返回其值:
    2. The slice() method works only with arrays whose elements are strings, numbers, or boolean values.

      只有字符串,数字,布尔值三种类型的数组可以用 slice 操作

    3. Indexes can also be negative. If you specify a negative index in the first parameter, it will shift the end of the sequence. For example, slice(-4) call will extract the last four elements of the sequence:

      index 可以是复数,arr.slice(-4)代表从倒数第四个值到最后

    4. The slice() method does not change the source array, but returns a copy of the array


  9. Apr 2020
  10. Mar 2020
    1. "48 61 76 65 20 79 6f 75 20 73 65 65 6e 20 74 68 65 20 73 6f 75 72 63 65 20 63 6f 64 65 20 6f 66 20 74 68 65 20 4a 65 74 42 72 61 69 6e 73 20 77 65 62 73 69 74 65 3f".split(' ').map(ch => String.fromCharCode((parseInt(ch, 16)))).join('')

      js 16进制转字符

  11. Feb 2020
  12. Jan 2020
  13. Dec 2019
    1. If you need polyfills in your code, consider including core-js in your package.json. This is will configure @babel/present-env to automatically include polyfills based on usage.
  14. Nov 2019
  15. Oct 2019
  16. Aug 2019
  17. Jul 2019
    1. Lexical scope is sometimes also referred to as Static Scope.

      Lexical scope only depends on the code text and not on the runtime callstack

  18. Jun 2019
    1. In this article, we are going to talk about the same kind of much-debated back-end programming technologies like Node.Js and PHP! We will know how do they differ from each other and why Node.js vs PHP is such a hot topic among developers.
  19. May 2019
  20. Apr 2019
  21. Feb 2019
    1. Top Reasons Why to Use Node.js for your E-commerce Business

      The arrival of E-commerce has changed how we shop today in our daily lives. Customers are seen buying on social media channels, Mobile apps, and websites. A set of heavy lighting goes behind an instinctive e-commerce website development that is described by the technical expertise that let into building it.

  22. Dec 2018
  23. Nov 2018
  24. Oct 2018