<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Js on Tianyi as a Developer</title>
    <link>/js/</link>
    <description>Recent content in Js on Tianyi as a Developer</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <lastBuildDate>Tue, 07 Apr 2020 00:00:00 +0000</lastBuildDate>
    
	<atom:link href="/js/index.xml" rel="self" type="application/rss+xml" />
    
    
    <item>
      <title>Javascript Async Examples</title>
      <link>/js/javascript-async/</link>
      <pubDate>Tue, 07 Apr 2020 00:00:00 +0000</pubDate>
      
      <guid>/js/javascript-async/</guid>
      <description>Error propagatioon It is not necessary to
async function foo() { let rand = ~~(Math.random() * 10); if (rand % 2) { return &amp;quot;Hello&amp;quot;; } else throw Error(&amp;quot;Error at foo!&amp;quot;); } async function bar() { let x = await foo(); x += &amp;quot; world&amp;quot;; return x; } async function baz() { let y = await bar(); y += &amp;quot;!!!&amp;quot;; return y; } let a = 0; (async () =&amp;gt; { for (let i = 0; i &amp;lt; 10; i++) { try { res = await baz(); console.</description>
    </item>
    
    <item>
      <title>Creating Multidimensional Arrays in Javascript</title>
      <link>/js/js-ndarray/</link>
      <pubDate>Mon, 23 Mar 2020 00:00:00 +0000</pubDate>
      
      <guid>/js/js-ndarray/</guid>
      <description>Initialising multidimensional arrays in Javascript can be tricky because some initialisation approches lead to unexpected behaviour due to shallow copying.
2D Arrays (Matrices) If we try to create a 4 \(\times\) 4 matrix by filling an empty array with 4 zero-filled arrays each with 4 zeros using the Array(n).fill(e) syntax:
let arr = Array(4).fill(Array(4).fill(0)); console.table(arr); ┌─────────┬───┬───┬───┬───┐ │ (index) │ 0 │ 1 │ 2 │ 3 │ ├─────────┼───┼───┼───┼───┤ │ 0 │ 0 │ 0 │ 0 │ 0 │ │ 1 │ 0 │ 0 │ 0 │ 0 │ │ 2 │ 0 │ 0 │ 0 │ 0 │ │ 3 │ 0 │ 0 │ 0 │ 0 │ └─────────┴───┴───┴───┴───┘ and then try to change the element \(arr_{1,2}\):</description>
    </item>
    
  </channel>
</rss>