<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Coding Beauty Tutorials - Medium]]></title>
        <description><![CDATA[Easy-to-digest walkthroughs on common programming tasks - Medium]]></description>
        <link>https://medium.com/codingbeauty-tutorials?source=rss----4898fe0f97c2---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Coding Beauty Tutorials - Medium</title>
            <link>https://medium.com/codingbeauty-tutorials?source=rss----4898fe0f97c2---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 06:53:49 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/codingbeauty-tutorials" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How to Convert an Array to a Map in JavaScript]]></title>
            <link>https://medium.com/codingbeauty-tutorials/javascript-convert-array-to-map-12907a8a334a?source=rss----4898fe0f97c2---4</link>
            <guid isPermaLink="false">https://medium.com/p/12907a8a334a</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Tari Ibaba]]></dc:creator>
            <pubDate>Wed, 18 Sep 2024 03:35:45 GMT</pubDate>
            <atom:updated>2024-09-18T03:34:01.512Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ph-tVFCic4a3NwlIfd7Jmw.png" /></figure><p>In this article, we’ll be looking at two ways to quickly convert an array of objects to a Map object in JavaScript.</p><h3>1. Map() Constructor and Array map()</h3><p>To convert an array of objects to a map, we can use the Array map() method to create an array of key-value pairs, and then pass the resulting array to a Map() constructor to create a Map object.</p><pre>const arr = [<br>  { key: &#39;user1&#39;, value: &#39;John&#39; },<br>  { key: &#39;user2&#39;, value: &#39;Kate&#39; },<br>  { key: &#39;user3&#39;, value: &#39;Peter&#39; },<br>];<br>const map = new Map(arr.map((obj) =&gt; [obj.key, obj.value]));</pre><pre>// Map(3) { &#39;user1&#39; =&gt; &#39;John&#39;, &#39;user2&#39; =&gt; &#39;Kate&#39;, &#39;user3&#39; =&gt; &#39;Peter&#39; }<br>console.log(map);</pre><p>In the callback passed to the map() method, we return an array containing the key and the value for each object. This will result in an array of key-value pairs:</p><pre>// [ [ &#39;user1&#39;, &#39;John&#39; ], [ &#39;user2&#39;, &#39;Kate&#39; ], [ &#39;user3&#39;, &#39;Peter&#39; ] ]<br>console.log(arr.map((obj) =&gt; [obj.key, obj.value]));</pre><p>The Map constructor can take an array of this form as an argument to create a Map object.</p><h3>2. Map set() and Array forEach()</h3><p>Another way to convert an array of objects to a map is with the Array forEach() method. First, we create a new Map object. Then, we add entries for all the array elements to the Map, by calling the Map set() method in the callback passed to forEach(). Here&#39;s an example:</p><pre>const arr = [<br>  { key: &#39;user1&#39;, value: &#39;John&#39; },<br>  { key: &#39;user2&#39;, value: &#39;Kate&#39; },<br>  { key: &#39;user3&#39;, value: &#39;Peter&#39; },<br>];</pre><pre>const map = new Map();<br>arr.forEach((obj) =&gt; {<br>  map.set(obj.key, obj.value);<br>});</pre><pre>// Map(3) { &#39;user1&#39; =&gt; &#39;John&#39;, &#39;user2&#39; =&gt; &#39;Kate&#39;, &#39;user3&#39; =&gt; &#39;Peter&#39; }<br>console.log(map);</pre><h3>Every Crazy Thing JavaScript Does</h3><p>Just when you thought you knew all the quirks.<br>Avoid painful bugs and save valuable time with <strong>Every Crazy Thing JavaScript Does, </strong>a captivating guide to the subtle caveats and lesser-known parts of JavaScript.</p><p><strong>Get a free copy </strong><a href="https://cbdev.link/d3c4eb"><strong>here</strong></a><strong> today.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/350/1*YS5Oub8REWy8vnOEqBnsyQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=12907a8a334a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codingbeauty-tutorials/javascript-convert-array-to-map-12907a8a334a">How to Convert an Array to a Map in JavaScript</a> was originally published in <a href="https://medium.com/codingbeauty-tutorials">Coding Beauty Tutorials</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Fix the “Component is missing template or render function” Warning in Vue]]></title>
            <link>https://medium.com/codingbeauty-tutorials/vue-component-is-missing-template-or-render-function-53275060bcff?source=rss----4898fe0f97c2---4</link>
            <guid isPermaLink="false">https://medium.com/p/53275060bcff</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[vue]]></category>
            <dc:creator><![CDATA[Tari Ibaba]]></dc:creator>
            <pubDate>Mon, 30 Oct 2023 17:50:21 GMT</pubDate>
            <atom:updated>2022-09-09T08:45:18.723Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q_g1tpd2ewBysxUBFM9jSg.png" /></figure><p>In this article, we’ll learn how to easily fix the “Component is missing template or render function” warning in Vue.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/515/0*pnuHXChZ60dVSL4f.png" /></figure><p>Here are some possible causes of this warning:</p><ol><li>Rendering a component that has no template.</li><li>Not passing the App component to the createApp() method.</li><li>Using the result of app.component() to set a component for a Vue Router route.</li></ol><p>We’ll go through each of them in this article.</p><h3>1. Rendering a component that has no template</h3><p>The “Component is missing template or render function” warning occurs when you import a component and add it to the markup, but the file of the component has no template tag. To fix it, add a template tag with a child element to the component file.</p><p><strong>App.vue</strong></p><pre>&lt;template&gt;<br>  &lt;div id=&quot;app&quot;&gt;<br>    &lt;post-list&gt;&lt;/post-list&gt;<br>  &lt;/div&gt;<br>&lt;/template&gt;</pre><pre>&lt;script&gt;<br>import PostList from &#39;./components/PostList.vue&#39;;</pre><pre>export default {<br>  components: {<br>    &#39;post-list&#39;: PostList,<br>  },<br>};<br>&lt;/script&gt;</pre><p><strong>components/PostList.vue</strong></p><pre>// ⚠️ empty file</pre><p>There will be a warning because PostList.vue is empty and doesn&#39;t have a template tag.</p><p>Here’s how we can remove the warning:</p><p><strong>components/PostList.vue</strong></p><pre>&lt;template&gt;<br>  &lt;div&gt;&lt;/div&gt;<br>&lt;/template&gt;</pre><h3>2. Not passing the App component to the createApp() method</h3><p>To fix the “Component is missing template or render function” warning in Vue, ensure that the createApp() method is called with the App component as an argument.</p><p>For example, the file that sets up your Vue app might look like this:</p><p><strong>main.js</strong></p><pre>import { createApp } from &#39;vue&#39;;<br>import * as VueRouter from &#39;vue-router&#39;;<br>import Home from &#39;./HomePage.vue&#39;;</pre><pre>// ⚠️ don&#39;t pass {} to createApp()!<br>const app = createApp({});</pre><pre>const routes = [{ path: &#39;/&#39;, component: Home }];</pre><pre>const router = VueRouter.createRouter({<br>  history: VueRouter.createWebHashHistory(),<br>  routes,<br>});</pre><pre>app.use(router);</pre><pre>app.mount(&#39;#app&#39;);</pre><p>There will be a warning here because we passed an empty object ({}) to createApp() instead of a component object.</p><p>We can remove the warning in this case by importing the App component and passing it to createApp():</p><pre>import { createApp } from &#39;vue&#39;;<br>import * as VueRouter from &#39;vue-router&#39;;<br>import Home from &#39;./HomePage.vue&#39;;</pre><pre>// import App component<br>import App from &#39;./App.vue&#39;;</pre><pre>// ✅ removed warning<br>const app = createApp(App);</pre><pre>const routes = [{ path: &#39;/&#39;, component: Home }];</pre><pre>const router = VueRouter.createRouter({<br>  history: VueRouter.createWebHashHistory(),<br>  routes,<br>});</pre><pre>app.use(router);</pre><pre>app.mount(&#39;#app&#39;);</pre><h3>3. Using the result of app.component() to set a component for a Vue Router route</h3><p>Instead of importing a component from a file, you might have chosen to create one with the component() method of the object returned by createApp().</p><pre>import { createApp } from &#39;vue/dist/vue.esm-bundler&#39;;<br>import * as VueRouter from &#39;vue-router&#39;;<br>import App from &#39;./App.vue&#39;;</pre><pre>const app = createApp(App);</pre><pre>// app.component() returns the app instance, not a component<br>// object<br>const Home = app.component(&#39;HomePage&#39;, {<br>  template: &#39;&lt;div&gt;Home&lt;/div&gt;&#39;,<br>});</pre><pre>// ⚠️ don&#39;t set &quot;component&quot; to the app instance!<br>const routes = [{ path: &#39;/&#39;, component: Home }];</pre><pre>const router = VueRouter.createRouter({<br>  history: VueRouter.createWebHashHistory(),<br>  routes,<br>});</pre><pre>app.use(router);</pre><pre>app.mount(&#39;#app&#39;);</pre><p>When app.component() is called with a definition object (the 2nd argument), it returns the application instance to allow chaining calls.</p><p>To fix the “Component is missing template or render function” warning in this case, call the app.component() method again with only the component name as an argument, and use the component object returned to define a route for Vue Router.</p><pre>import { createApp } from &#39;vue/dist/vue.esm-bundler&#39;;<br>import * as VueRouter from &#39;vue-router&#39;;<br>import App from &#39;./App.vue&#39;;</pre><pre>const app = createApp(App);</pre><pre>// first app.component() call defines component<br>app.component(&#39;HomePage&#39;, {<br>  template: &#39;&lt;div&gt;Home&lt;/div&gt;&#39;,<br>});</pre><pre>// ✅ fix: second app.component() call returns component object<br>const Home = app.component(&#39;HomePage&#39;);</pre><pre>// ✅ sets &quot;component&quot; to component object<br>const routes = [{ path: &#39;/&#39;, component: Home }];</pre><pre>const router = VueRouter.createRouter({<br>  history: VueRouter.createWebHashHistory(),<br>  routes,<br>});</pre><pre>app.use(router);</pre><pre>app.mount(&#39;#app&#39;);</pre><p><em>Originally published at </em><a href="https://cbdev.link/5270e1"><em>codingbeautydev.com</em></a></p><h3>Every Crazy Thing JavaScript Does</h3><p>A captivating guide to the subtle caveats and lesser-known parts of JavaScript.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/350/1*YS5Oub8REWy8vnOEqBnsyQ.png" /></figure><p><a href="https://cbdev.link/d3c4eb">Sign up</a> and receive a free copy immediately.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=53275060bcff" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codingbeauty-tutorials/vue-component-is-missing-template-or-render-function-53275060bcff">How to Fix the “Component is missing template or render function” Warning in Vue</a> was originally published in <a href="https://medium.com/codingbeauty-tutorials">Coding Beauty Tutorials</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Fix “An Implementation Cannot Be Declared in Ambient Contexts” Error in TypeScript]]></title>
            <link>https://medium.com/codingbeauty-tutorials/typescript-an-implementation-cannot-be-declared-in-ambient-contexts-900db595a1b5?source=rss----4898fe0f97c2---4</link>
            <guid isPermaLink="false">https://medium.com/p/900db595a1b5</guid>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Tari Ibaba]]></dc:creator>
            <pubDate>Thu, 26 Oct 2023 18:19:06 GMT</pubDate>
            <atom:updated>2022-06-09T12:21:53.529Z</atom:updated>
            <content:encoded><![CDATA[<h4>A guide on how to fix the “an implementation cannot be declared in ambient contexts” error in TypeScript.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_5Q5LFmXxgcMVQFJCJT5nw.png" /></figure><p>Are you experiencing the “an implementation cannot be declared in ambient contexts” error in TypeScript? This error can occur when you try to include logic in declaration files, for example:</p><p><strong>car.d.ts</strong></p><pre>declare module &#39;car&#39; {<br>  export class Car {<br>    color: string;<br>    maxSpeed: number;<br>    started: boolean;</pre><pre>    // Error: An implementation cannot be declared in ambient contexts<br>    start() {<br>      this.started = true;<br>    }<br>  }<br>}</pre><p>Ambient declarations only exist in the type system and are erased at runtime, so they are not meant to contain implementations. The car module declaration in the example above is only meant to specify type information for a car module that is implemented somewhere else.</p><p>To fix this error, remove the implementation:</p><p><strong>car.d.ts</strong></p><pre>declare module &#39;car&#39; {<br>  export class Car {<br>    color: string;<br>    maxSpeed: number;<br>    started: boolean;</pre><pre>    start(); // implementation removed<br>  }<br>}</pre><p><em>Updated at: </em><a href="https://codingbeautydev.com/blog/typescript-an-implementation-cannot-be-declared-in-ambient-contexts/"><em>codingbeautydev.com</em></a></p><p>Get new web development tips and tutorials every week.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KLG9Wxq6Sqt3jxTaL00Tnw.png" /></figure><p><a href="https://codingbeautydev.com/newsletter"><strong>Subscribe</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=900db595a1b5" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codingbeauty-tutorials/typescript-an-implementation-cannot-be-declared-in-ambient-contexts-900db595a1b5">Fix “An Implementation Cannot Be Declared in Ambient Contexts” Error in TypeScript</a> was originally published in <a href="https://medium.com/codingbeauty-tutorials">Coding Beauty Tutorials</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Remove a Class from the Body Element using JavaScript]]></title>
            <link>https://medium.com/codingbeauty-tutorials/javascript-remove-class-from-body-d79e44e31497?source=rss----4898fe0f97c2---4</link>
            <guid isPermaLink="false">https://medium.com/p/d79e44e31497</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Tari Ibaba]]></dc:creator>
            <pubDate>Tue, 24 Oct 2023 21:12:13 GMT</pubDate>
            <atom:updated>2022-07-21T20:01:50.395Z</atom:updated>
            <content:encoded><![CDATA[<h3>How to Remove a Class from the Body Element Using JavaScript</h3><h4>Learn how to easily remove a class from the body element of an HTML document using JavaScript.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s96GfjqiyTjSxTOMcxg0ew.png" /></figure><p>In this article, we’ll be looking at how to easily remove a class from the body element of an HTML document using JavaScript.</p><h3>The DOMTokenList remove() Method</h3><p>To remove a class from the body element, call the classList.remove() method on the body element, e.g, document.body.classList.remove(&#39;the-class)&#39;.</p><p>Here is some sample HTML:</p><p><strong>index.html</strong></p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html&gt;<br>  &lt;head&gt;<br>    &lt;title&gt;Coding Beauty Tutorial&lt;/title&gt;<br>  &lt;/head&gt;<br>  &lt;body class=&quot;class-1 class-2&quot;&gt;<br>    &lt;div&gt;This is a div element.&lt;/div&gt;</pre><pre>    &lt;script src=&quot;index.js&quot;&gt;&lt;/script&gt;<br>  &lt;/body&gt;<br>&lt;/html&gt;</pre><p>Here’s how we can remove the class class-1 from the body using JavaScript:</p><p><strong>index.js</strong></p><pre>document.body.classList.remove(&#39;class-1&#39;);</pre><p>We use the body property of the document to access the HTMLElement object that represents the document body.</p><p>The classList property returns a DOMTokenList object that represents the list of classes an element has.</p><p>The <a href="https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/remove">remove()</a> method of the classList property takes a list of classes and removes them from an element.</p><p>After removing class-1, the document markup will look like this:</p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html&gt;<br>  &lt;head&gt;<br>    &lt;title&gt;Coding Beauty Tutorial&lt;/title&gt;<br>  &lt;/head&gt;<br>  &lt;body class=&quot;class-2&quot;&gt;<br>    &lt;div&gt;This is a div element.&lt;/div&gt;</pre><pre>    &lt;script src=&quot;index.js&quot;&gt;&lt;/script&gt;<br>  &lt;/body&gt;<br>&lt;/html&gt;</pre><p>We can pass multiple arguments to the remove() method to remove more than one class from the body. For example, we can remove both class-1 and class-2 from the body using a single statement:</p><p><strong>index.js</strong></p><pre>document.body.classList.remove(&#39;class-1&#39;, &#39;class-2&#39;);</pre><p>This will be the resulting document markup:</p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html&gt;<br>  &lt;head&gt;<br>    &lt;title&gt;Coding Beauty Tutorial&lt;/title&gt;<br>  &lt;/head&gt;<br>  &lt;body&gt;<br>    &lt;div&gt;This is a div element.&lt;/div&gt;</pre><pre>    &lt;script src=&quot;index.js&quot;&gt;&lt;/script&gt;<br>  &lt;/body&gt;<br>&lt;/html&gt;</pre><p>If we pass a class that the element does not have, remove() ignores the class and does not throw an error.</p><h3>How to Add a Class to the Body element</h3><p>To add a class to the body element, we can use the classList.add() method of the body object.</p><p><strong>index.js</strong></p><pre>document.body.classList.add(&#39;class-3&#39;, &#39;class-4&#39;);</pre><p>The <a href="https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/add">add()</a> method of the classList property takes a list of class names and adds them to an element.</p><p>This will be the resulting HTML after adding the two classes:</p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html&gt;<br>  &lt;head&gt;<br>    &lt;title&gt;Coding Beauty Tutorial&lt;/title&gt;<br>  &lt;/head&gt;<br>  &lt;body class=&quot;class-1 class-2 class-3 class-4&quot;&gt;<br>    &lt;div&gt;This is a div element.&lt;/div&gt;</pre><pre>    &lt;script src=&quot;index.js&quot;&gt;&lt;/script&gt;<br>  &lt;/body&gt;<br>&lt;/html&gt;</pre><p>add() prevents the same class from being added to an element multiple times, so a specified class is ignored if the element already has it.</p><p><em>Updated at: </em><a href="https://cbdev.link/79f2c0"><em>codingbeautydev.com</em></a></p><h3>Every Crazy Thing JavaScript Does</h3><p>A captivating guide to the subtle caveats and lesser-known parts of JavaScript.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/350/1*YS5Oub8REWy8vnOEqBnsyQ.png" /></figure><p><a href="https://cbdev.link/d3c4eb"><strong>Sign up</strong></a> and receive a free copy immediately.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d79e44e31497" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codingbeauty-tutorials/javascript-remove-class-from-body-d79e44e31497">How to Remove a Class from the Body Element using JavaScript</a> was originally published in <a href="https://medium.com/codingbeauty-tutorials">Coding Beauty Tutorials</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Rotate an Image with JavaScript]]></title>
            <link>https://medium.com/codingbeauty-tutorials/javascript-rotate-image-ad2f05eafeb2?source=rss----4898fe0f97c2---4</link>
            <guid isPermaLink="false">https://medium.com/p/ad2f05eafeb2</guid>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Tari Ibaba]]></dc:creator>
            <pubDate>Wed, 30 Aug 2023 12:07:54 GMT</pubDate>
            <atom:updated>2022-08-20T08:06:03.538Z</atom:updated>
            <content:encoded><![CDATA[<h4>1. Rotate the image counter-clockwise, 2. Customize image transform origin, 3. Rotate image on button click, 4. Rotate image incrementally.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Pmj2MtWbSbg5sqbjGYxGBg.png" /></figure><p>To rotate an image with JavaScript, access the image element with a method like getElementById(), then set the style.transform property to a string in the format rotate({value}deg), where {value} is the clockwise angle of rotation in degrees.</p><p>Consider this sample HTML:</p><p><strong>index.html</strong></p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html&gt;<br>  &lt;head&gt;<br>    &lt;title&gt;JavaScript Rotate Image&lt;/title&gt;<br>  &lt;/head&gt;<br>  &lt;body&gt;<br>    &lt;div style=&quot;margin: 8px&quot;&gt;<br>      &lt;img src=&quot;my-image.jpg&quot; width=&quot;300&quot; /&gt;</pre><pre>      &lt;!-- The image element to rotate --&gt;<br>      &lt;img id=&quot;rotated&quot; src=&quot;my-image.jpg&quot; width=&quot;300&quot; /&gt;<br>    &lt;/div&gt;</pre><pre>    &lt;script src=&quot;index.js&quot;&gt;&lt;/script&gt;<br>  &lt;/body&gt;<br>&lt;/html&gt;</pre><p>Here’s how to easily rotate the #rotated image element from JavaScript:</p><p><strong>index.js</strong></p><pre>// Access DOM element object<br>const rotated = document.getElementById(&#39;rotated&#39;);</pre><pre>// Rotate element by 90 degrees clockwise<br>rotated.style.transform = &#39;rotate(90deg)&#39;;</pre><p>And this will be the result on the web page:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/628/0*i_T686qzcqBBjmEc.png" /></figure><p>First, we access the DOM element object with the document.<a href="https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementById">getElementById()</a> method.</p><p>Then, we use the style.transform property of the object to set the <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/transform">transform</a> CSS property of the element from JavaScript.</p><p>We can specify any angle between 1 and 359 for the rotation:</p><pre>// Access DOM element object<br>const rotated = document.getElementById(&#39;rotated&#39;);</pre><pre>// Rotate element by 180 degrees clockwise<br>rotated.style.transform = &#39;rotate(180deg)&#39;;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/641/0*iY9PFy1eYW_IeALS.png" /></figure><h3>Rotate Image Counter-Clockwise</h3><p>We can rotate an image in the counter-clockwise direction by specifying a negative angle.</p><pre>// Access DOM element object<br>const rotated = document.getElementById(&#39;rotated&#39;);</pre><pre>// Rotate image by 90 degrees counter-clockwise<br>rotated.style.transform = &#39;rotate(-90deg)&#39;;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/596/0*IfQ5L-fDRStiONTk.png" /></figure><p>We can specify any angle between -1 and -359 degrees for counter-clockwise rotation.</p><pre>// Access DOM element object<br>const rotated = document.getElementById(&#39;rotated&#39;);</pre><pre>// Rotate image by 135 degrees counter-clockwise<br>rotated.style.transform = &#39;rotate(-135deg)&#39;;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/673/0*wF7dqZbGJ1BV0DE9.png" /></figure><h3>Customize Image Transform Origin</h3><p>We can use the <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/transform-origin">transform-origin</a> CSS property to set the point that the image will be rotated about. transform-origin is center by default, which means the element will be rotated about its center point.</p><p>In the following example, we rotate the image 90 degrees clockwise, as we did in the first example in this article.</p><pre>// Access DOM element object<br>const rotated = document.getElementById(&#39;rotated&#39;);</pre><pre>// Rotate image by 90 degrees clockwise<br>rotated.style.transform = &#39;rotate(90deg)&#39;;</pre><pre>// Rotate image about top-left corner<br>rotated.style.transformOrigin = &#39;top left&#39;;</pre><p>But this time we customize the transform-origin property, so the image element ends up at a different position after the rotation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/459/0*awBNZixEmkQ1Rniw.png" /></figure><h3>Rotate Image on Button Click</h3><p>To rotate the image at the click of a button, assign an event handler function to the onclick attribute of the button element.</p><p>For example:</p><p><strong>index.html</strong></p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html&gt;<br>  &lt;head&gt;<br>    &lt;title&gt;JavaScript Rotate Image&lt;/title&gt;<br>  &lt;/head&gt;<br>  &lt;body&gt;<br>    &lt;div&gt;<br>      &lt;!-- Assign &quot;rotateImage()&quot; to &quot;onclick&quot; attribute --&gt;<br>      &lt;button id=&quot;rotate&quot; onclick=&quot;rotateImage()&quot;&gt;Rotate image&lt;/button&gt;</pre><pre>      &lt;!-- The image element to be rotated --&gt;<br>      &lt;img id=&quot;rotated&quot; src=&quot;my-image.jpg&quot; width=&quot;300&quot; /&gt;<br>    &lt;/div&gt;</pre><pre>    &lt;script src=&quot;index.js&quot;&gt;&lt;/script&gt;<br>  &lt;/body&gt;<br>&lt;/html&gt;</pre><p>Here the rotateImage() function serves as the click event handler. It contains the logic for rotating the image and will be called when the button is clicked.</p><p><strong>index.js</strong></p><pre>// Access DOM element object<br>const rotated = document.getElementById(&#39;rotated&#39;);</pre><pre>function rotateImage() {<br>  // Rotate image by 90 degrees clockwise<br>  rotated.style.transform = &#39;rotate(90deg)&#39;;<br>}</pre><p>Now when the button is clicked, the image will be rotated 90 degrees in the clockwise direction.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/0*z90HhOcRv0J79sGx.gif" /></figure><h3>Rotate Image Incrementally</h3><p>We can incrementally rotate the image on button click by storing the angle of rotation in a variable and using this variable to get and update the current angle. Many image editing apps allow you to rotate images in 90-degree angle increments.</p><p><strong>index.js</strong></p><pre>// Access DOM element object<br>const rotated = document.getElementById(&#39;rotated&#39;);</pre><pre>// Variable to hold the current angle of rotation<br>let rotation = 0;</pre><pre>// How much to rotate the image at a time<br>const angle = 90;</pre><pre>function rotateImage() {<br>  // Ensure angle range of 0 to 359 with &quot;%&quot; operator,<br>  // e.g., 450 -&gt; 90, 360 -&gt; 0, 540 -&gt; 180, etc.<br>  rotation = (rotation + angle) % 360;</pre><pre>  rotated.style.transform = `rotate(${rotation}deg)`;<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/0*-FEBQ3hy6KVaWMFj.gif" /></figure><p><em>Originally published at </em><a href="https://cbdev.link/335223"><em>codingbeautydev.com</em></a></p><h3>11 Amazing New JavaScript Features in ES13</h3><p>This guide will bring you up to speed with all the latest features added in ECMAScript 13. These powerful new features will modernize your JavaScript with shorter and more expressive code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/256/1*WqVjQY7sKZh3wld5WzkfTw.png" /></figure><p><a href="https://cbdev.link/900477">Sign up</a> and immediately receive a free copy.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ad2f05eafeb2" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codingbeauty-tutorials/javascript-rotate-image-ad2f05eafeb2">How to Rotate an Image with JavaScript</a> was originally published in <a href="https://medium.com/codingbeauty-tutorials">Coding Beauty Tutorials</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to quickly get the union of two arrays in JavaScript]]></title>
            <link>https://medium.com/codingbeauty-tutorials/javascript-get-union-of-arrays-f1d15ce8acf1?source=rss----4898fe0f97c2---4</link>
            <guid isPermaLink="false">https://medium.com/p/f1d15ce8acf1</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Coding Beauty Tutorials]]></dc:creator>
            <pubDate>Wed, 30 Aug 2023 01:56:36 GMT</pubDate>
            <atom:updated>2023-08-30T17:26:18.128Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MKnNS_eWor0MztW1PgZZkw.png" /></figure><p>To get the union of two arrays in JavaScript, merge the arrays, create a new Set object from the merged result to remove the duplicates, then convert it back to an array, i.e., Array.from(new Set([...arr1, ...arr2])).</p><p>For example:</p><pre>function getUnion(arr1, arr2) {<br>  return Array.from(new Set([...arr1, ...arr2]));<br>}<br><br>const array1 = [1, 2, 3, 4, 5];<br>const array2 = [4, 5, 6, 7, 8];<br>const union = getUnion(array1, array2); // [1, 2, 3, 4, 5, 6, 7, 8]<br>console.log(union);</pre><h3>Array.from() method</h3><p>The Array from() method converts Sets and other iterable objects to arrays.</p><pre>const set = new Set([&#39;Paul&#39;, &#39;John&#39;, &#39;George&#39;, &#39;Ringo&#39;]);<br>const arr = Array.from(exampleSet);<br><br>console.log(arr);  // [&#39;Paul&#39;, &#39;John&#39;, &#39;George&#39;, &#39;Ringo&#39;]<br>const map = new Map();<br>map.set(&#39;Bob&#39;, &#39;Marley&#39;);<br>map.set(&#39;Mick&#39;, &#39;Jagger&#39;);<br>let arr2 = Array.from(map);<br>console.log(exampleArray2);  // [ [&#39;Bob&#39;, &#39;Marley&#39;], [&#39;Mick&#39;, &#39;Jagger&#39;] ]</pre><h3>Set() constructor</h3><p>We create these sets with the Set constructor, which <strong>can only contain unique values</strong>, so it removes any possible duplicates that may be in the array it receives.</p><pre>const set = new Set([1, 1, 2, 3, 3, 4]);<br>console.log(Array.from(set)); // [1, 2, 3, 4]</pre><h3>Spread syntax (...)</h3><p>To pass this array to the Set() constructor, we use the spread syntax (...) to merge the two arrays together. The spread syntax unpacks the value of each array into another array:</p><pre>const array1 = [10, 20, 30];<br>const array2 = [40, 50, 60];<br><br>const mergedArray = [...array1, ...array2];<br><br>console.log(mergedArray);</pre><h3>Use Array concat() to merge arrays for Set()</h3><p>We could use the Array concat() method in place of the spread syntax:</p><pre>function getUnion(arr1, arr2) {<br>  return Array.from(new Set(arr1.concat(arr2)));<br>}</pre><h3>Use Array from() to convert Set back to array</h3><p>And we could use this spread syntax to replace the Array from(), although this may make the code a bit less readable:</p><pre>function getUnion(arr1, arr2) {<br>  return [...new Set([...arr1, ...arr2])];<br>}<br><br>const array1 = [1, 2, 3, 4, 5];<br>const array2 = [4, 5, 6, 7, 8];<br>const union = getUnion(array1, array2); // [1, 2, 3, 4, 5, 6, 7, 8]<br>console.log(union);</pre><p>We can use the same principles to easily get the union of two sets in JavaScript.</p><h3>Get union of two sets in JavaScript</h3><p>To get the union of two sets in JavaScript, convert the sets to arrays and merge them, then create a Set from the results of the merge.</p><p>For example:</p><pre>function getUnion(set1, set2) {<br>  return new Set([...set1, ...set2]);<br>}<br><br>const set1 = new Set([&#39;a&#39;, &#39;b&#39;, &#39;c&#39;, &#39;d&#39;]);<br>const set2 = new Set([&#39;c&#39;, &#39;d&#39;, &#39;e&#39;, &#39;f&#39;]);<br><br>const union = getUnion(set1, set2);<br><br>console.log(union); // Set(6) { &#39;a&#39;, &#39;b&#39;, &#39;c&#39;, &#39;d&#39;, &#39;e&#39;, &#39;f&#39; }</pre><h3>Key takeaways</h3><ul><li>To get the union of two arrays in JavaScript, create a new Set object from the merge of the two arrays, then convert this Set object to an array again, i.e., Array.from(new Set(arr1.concat(arr2))).</li><li>We can do a similar thing to get the union of two sets, i.e., new Set([...set1, ...set2]).</li></ul><h3>Every Crazy Thing JavaScript Does</h3><p>Just when you thought you knew all the quirks.<br>Avoid painful bugs and save valuable time with <strong>Every Crazy Thing JavaScript Does, </strong>a captivating guide to the subtle caveats and lesser-known parts of JavaScript.</p><p><strong>Get a free copy </strong><a href="https://cbdev.link/d3c4eb"><strong>here</strong></a><strong> today.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/350/1*YS5Oub8REWy8vnOEqBnsyQ.png" /></figure><p><em>Originally published at </em><a href="https://codingbeautydev.com/blog/javascript-get-union-of-arrays/?utm_source=medium&amp;utm_medium=social&amp;utm_campaign=blog"><em>codingbeautydev.com</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f1d15ce8acf1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codingbeauty-tutorials/javascript-get-union-of-arrays-f1d15ce8acf1">How to quickly get the union of two arrays in JavaScript</a> was originally published in <a href="https://medium.com/codingbeauty-tutorials">Coding Beauty Tutorials</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Use Cards in Vuetify]]></title>
            <link>https://medium.com/codingbeauty-tutorials/how-to-use-cards-in-vuetify-ab50243cd7c7?source=rss----4898fe0f97c2---4</link>
            <guid isPermaLink="false">https://medium.com/p/ab50243cd7c7</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[vuejs]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[vuetifyjs]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Tari Ibaba]]></dc:creator>
            <pubDate>Tue, 15 Aug 2023 23:01:37 GMT</pubDate>
            <atom:updated>2022-03-12T10:48:54.984Z</atom:updated>
            <content:encoded><![CDATA[<h3>How to Create Cards with Vuetify</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DH3MqxfRV9_nOUrJn6esrQ.png" /></figure><p>The Card component in Vuetify is one that can be used for a wide range of things. We can use it to wrap a toolbar component, to contain a list, or just to display a static image. We can customize certain card features, such as <a href="https://codingbeautydev.com/blog/how-to-use-color-in-vuetify/">colour</a>, elevation, and size. In this article, you’ll learn how to create a simple card with the UI library.</p><h3>The “v-card” Component</h3><p>v-card is the name of the component provided by Vuetify for creating cards. We&#39;ve created one in the code below and customized its height and width with the respective props:</p><pre>&lt;template&gt;<br>  &lt;v-app&gt;<br>    &lt;div class=&quot;d-flex justify-center ma-4&quot;&gt;<br>      &lt;v-card height=&quot;150&quot; width=&quot;350&quot;&gt;&lt;/v-card&gt;<br>    &lt;/div&gt;<br>  &lt;/v-app&gt;<br>&lt;/template&gt;</pre><pre>&lt;script&gt;<br>export default {<br>  name: &#39;App&#39;,<br>};<br>&lt;/script&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/849/0*x1qib-MOlwpOc_RL.png" /></figure><h3>The “v-card-title” Component</h3><p>v-card comes along with certain supplementary components meant to be used in it (as children). One of such is the v-card-title component. As the name implies, it allows us to set the title of a card. For example:</p><pre>&lt;template&gt;<br>  &lt;v-app&gt;<br>    &lt;div class=&quot;d-flex justify-center ma-4&quot;&gt;<br>      &lt;v-card height=&quot;150&quot; width=&quot;350&quot;&gt;<br>        &lt;v-card-title&gt;data.zip&lt;/v-card-title&gt;<br>      &lt;/v-card&gt;<br>    &lt;/div&gt;<br>  &lt;/v-app&gt;<br>&lt;/template&gt;<br>...</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/849/0*XG2y385mkk05Zh6M.png" /></figure><h3>The “v-card-subtitle” Component</h3><p>We can also set card subtitles with the v-card-subtitle component. Being a subtitle, it is styled with a regular font-weight and smaller font size than the title.</p><pre>&lt;template&gt;<br>  &lt;v-app&gt;<br>    &lt;div class=&quot;d-flex justify-center ma-4&quot;&gt;<br>      &lt;v-card height=&quot;150&quot; width=&quot;350&quot;&gt;<br>        &lt;v-card-title&gt;data.zip&lt;/v-card-title&gt;<br>        &lt;v-card-subtitle&gt;Your data is ready&lt;/v-card-subtitle&gt;<br>      &lt;/v-card&gt;<br>    &lt;/div&gt;<br>  &lt;/v-app&gt;<br>&lt;/template&gt;<br>...</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/849/0*Au8rbbLm3ZOlfchn.png" /></figure><h3>Beautify with Vuetify</h3><p>The complete guide to creating elegant web apps with the Vuetify Material Design framework.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/980/1*Pg-HqRw-Bp7PL0OGpzELeQ.png" /></figure><p>Download a free copy <a href="https://mailchi.mp/583226ee0d7b/beautify-with-vuetify"><strong>here</strong></a><strong>!</strong></p><h3>The “v-card-text” Component</h3><p>We can use the v-card-text component to add text for the card body:</p><pre>&lt;template&gt;<br>  &lt;v-app&gt;<br>    &lt;div class=&quot;d-flex justify-center ma-4&quot;&gt;<br>      &lt;v-card width=&quot;350&quot;&gt;<br>        &lt;v-card-title&gt;data.zip&lt;/v-card-title&gt;<br>        &lt;v-card-subtitle&gt;Your data is ready&lt;/v-card-subtitle&gt;<br>        &lt;v-card-text<br>          &gt;You can now download an archive of all your data within the next 24<br>          hours.&lt;/v-card-text<br>        &gt;<br>      &lt;/v-card&gt;<br>    &lt;/div&gt;<br>  &lt;/v-app&gt;<br>&lt;/template&gt;<br>...</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/849/0*vcPpIHsoYiS2qzA2.png" /></figure><h3>The “v-card-actions” Component</h3><p>The v-card-actions component serves as a container for interactive components (like <a href="https://codingbeautydev.com/blog/how-to-use-buttons-in-vuetify/">buttons</a>) that let us take certain actions related to the information on the card:</p><pre>&lt;template&gt;<br>  &lt;v-app&gt;<br>    &lt;div class=&quot;d-flex justify-center ma-4&quot;&gt;<br>      &lt;v-card width=&quot;350&quot;&gt;<br>        &lt;v-card-title&gt;data.zip&lt;/v-card-title&gt;<br>        &lt;v-card-subtitle&gt;Your data is ready&lt;/v-card-subtitle&gt;<br>        &lt;v-card-text<br>          &gt;You can now download an archive of all your data within the next 24<br>          hours.&lt;/v-card-text<br>        &gt;<br>        &lt;v-card-actions&gt;<br>          &lt;v-btn text color=&quot;primary&quot;&gt;Download&lt;/v-btn&gt;<br>          &lt;v-btn text&gt;Cancel&lt;/v-btn&gt;<br>        &lt;/v-card-actions&gt;<br>      &lt;/v-card&gt;<br>    &lt;/div&gt;<br>  &lt;/v-app&gt;<br>&lt;/template&gt;<br>...</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/849/0*Ic16GIg1jX-9yjNe.png" /></figure><h3>Outlined Cards</h3><p>Setting the outlined property of the v-card component to true will remove the elevation of the card:</p><pre>&lt;template&gt;<br>  &lt;v-app&gt;<br>    &lt;div class=&quot;d-flex justify-center ma-4&quot;&gt;<br>      &lt;v-card width=&quot;350&quot; outlined&gt;<br>        &lt;v-card-title&gt;data.zip&lt;/v-card-title&gt;<br>        &lt;v-card-subtitle&gt;Your data is ready&lt;/v-card-subtitle&gt;<br>        &lt;v-card-text<br>          &gt;You can now download an archive of all your data within the next 24<br>          hours.&lt;/v-card-text<br>        &gt;<br>        &lt;v-card-actions&gt;<br>          &lt;v-btn text color=&quot;primary&quot;&gt;Download&lt;/v-btn&gt;<br>          &lt;v-btn text&gt;Cancel&lt;/v-btn&gt;<br>        &lt;/v-card-actions&gt;<br>      &lt;/v-card&gt;<br>    &lt;/div&gt;<br>  &lt;/v-app&gt;<br>&lt;/template&gt;<br>...</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/849/0*Hw4rnAfHmavtrGnF.png" /></figure><h3>The “elevation” Prop</h3><p>We can also set the specific amount of elevation we want for a card with the elevation prop:</p><pre>&lt;template&gt;<br>  &lt;v-app&gt;<br>    &lt;div class=&quot;d-flex justify-center ma-4&quot;&gt;<br>      &lt;v-card width=&quot;350&quot; elevation=&quot;5&quot;&gt;<br>        &lt;v-card-title&gt;data.zip&lt;/v-card-title&gt;<br>        &lt;v-card-subtitle&gt;Your data is ready&lt;/v-card-subtitle&gt;<br>        &lt;v-card-text<br>          &gt;You can now download an archive of all your data within the next 24<br>          hours.&lt;/v-card-text<br>        &gt;<br>        &lt;v-card-actions&gt;<br>          &lt;v-btn text color=&quot;primary&quot;&gt;Download&lt;/v-btn&gt;<br>          &lt;v-btn text&gt;Cancel&lt;/v-btn&gt;<br>        &lt;/v-card-actions&gt;<br>      &lt;/v-card&gt;<br>    &lt;/div&gt;<br>  &lt;/v-app&gt;<br>&lt;/template&gt;<br>...</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/849/0*BJbKf7ywa8z-cH4u.png" /></figure><h3>Summary</h3><p>Vuetify provides the v-card component for creating cards, which are used for a variety of functions.</p><p><a href="http://eepurl.com/hRfyJL"><em>Sign up</em></a><em> for our weekly newsletter to keep up to date with more great content from us!</em></p><p><em>Get the updated article at </em><a href="https://codingbeautydev.com/blog/vuetify-card/"><em>codingbeautydev.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ab50243cd7c7" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codingbeauty-tutorials/how-to-use-cards-in-vuetify-ab50243cd7c7">How to Use Cards in Vuetify</a> was originally published in <a href="https://medium.com/codingbeauty-tutorials">Coding Beauty Tutorials</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Use the Vuetify Bottom Sheet Component]]></title>
            <link>https://medium.com/codingbeauty-tutorials/vuetify-bottom-sheet-30f74e0e644b?source=rss----4898fe0f97c2---4</link>
            <guid isPermaLink="false">https://medium.com/p/30f74e0e644b</guid>
            <category><![CDATA[vuejs]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[vuetify]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Tari Ibaba]]></dc:creator>
            <pubDate>Tue, 15 Aug 2023 23:00:55 GMT</pubDate>
            <atom:updated>2022-05-10T19:57:09.929Z</atom:updated>
            <content:encoded><![CDATA[<h4>A comprehensive guide on using the Vuetify bottom sheet component to create bottom sheets that display supplementary information and actions</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1NzlWxXMSYUVRaEk_WOAAg.png" /></figure><p>A bottom sheet is a customized <a href="https://codingbeautydev.com/blog/vuetify-dialog/">v-dialog</a> that is anchored to the bottom of the screen, like a <a href="https://codingbeautydev.com/blog/vuetify-bottom-navigation/">v-bottom-navigation</a>. They are primarily used on mobile and can contain supplementary information and actions. In this article, we’re going to learn how to easily create and customize bottom sheets with the Vuetify bottom sheet component.</p><h3>The Vuetify Bottom Sheet Component (v-bottom-sheet)</h3><p>Vuetify provides the v-bottom-sheet component for creating a bottom sheet. Like <a href="https://codingbeautydev.com/blog/vuetify-dialog/">v-dialog</a>, this component comes with an activator slot that we can use to set a <a href="https://codingbeautydev.com/blog/vuetify-button/">button</a> that will open the sheet when clicked.</p><pre>&lt;template&gt;<br>  &lt;v-app&gt;<br>    &lt;div class=&quot;ma-4 text-center&quot;&gt;<br>      &lt;v-bottom-sheet v-model=&quot;sheet&quot;&gt;<br>        &lt;template v-slot:activator=&quot;{ on, attrs }&quot;&gt;<br>          &lt;v-btn<br>            v-bind=&quot;attrs&quot;<br>            v-on=&quot;on&quot;<br>            color=&quot;primary&quot;<br>          &gt;<br>            Open Sheet<br>          &lt;/v-btn&gt;<br>        &lt;/template&gt;<br>        &lt;v-sheet<br>          class=&quot;text-center&quot;<br>          height=&quot;200px&quot;<br>        &gt;<br>          &lt;v-btn<br>            class=&quot;mt-6&quot;<br>            text<br>            color=&quot;red&quot;<br>            @click=&quot;sheet = !sheet&quot;<br>          &gt;<br>            close<br>          &lt;/v-btn&gt;<br>          &lt;div class=&quot;my-3&quot;&gt;This is a bottom sheet&lt;/div&gt;<br>        &lt;/v-sheet&gt;<br>      &lt;/v-bottom-sheet&gt;<br>    &lt;/div&gt;<br>  &lt;/v-app&gt;<br>&lt;/template&gt;</pre><pre>&lt;script&gt;<br>export default {<br>  name: &#39;App&#39;,<br>  data: () =&gt; ({<br>    sheet: false,<br>  }),<br>};<br>&lt;/script&gt;</pre><pre>&lt;style&gt;<br>html {<br>  overflow-y: auto !important;<br>}<br>&lt;/style&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/932/0*Ad600xecc3gyvIDv.gif" /></figure><h3>Hide Overlay</h3><p>v-bottom-sheet comes with a hide-overlay prop that will remove the overlay when set to true.</p><pre>&lt;template&gt;<br>  &lt;v-app&gt;<br>    &lt;div class=&quot;ma-4 text-center&quot;&gt;<br>      &lt;v-bottom-sheet<br>        v-model=&quot;sheet&quot;<br>        hide-overlay<br>      &gt;<br>        &lt;template v-slot:activator=&quot;{ on, attrs }&quot;&gt;<br>          &lt;v-btn<br>            v-bind=&quot;attrs&quot;<br>            v-on=&quot;on&quot;<br>            color=&quot;primary&quot;<br>          &gt;<br>            Open Sheet<br>          &lt;/v-btn&gt;<br>        &lt;/template&gt;<br>        &lt;v-sheet<br>          class=&quot;text-center&quot;<br>          height=&quot;200px&quot;<br>        &gt;<br>          &lt;v-btn<br>            class=&quot;mt-6&quot;<br>            text<br>            color=&quot;red&quot;<br>            @click=&quot;sheet = !sheet&quot;<br>          &gt;<br>            close<br>          &lt;/v-btn&gt;<br>          &lt;div class=&quot;my-3&quot;&gt;This is a bottom sheet.&lt;/div&gt;<br>        &lt;/v-sheet&gt;<br>      &lt;/v-bottom-sheet&gt;<br>    &lt;/div&gt;<br>  &lt;/v-app&gt;<br>&lt;/template&gt;</pre><pre>&lt;script&gt;<br>export default {<br>  name: &#39;App&#39;,<br>  data: () =&gt; ({<br>    sheet: false,<br>  }),<br>};<br>&lt;/script&gt;</pre><pre>&lt;style&gt;<br>html {<br>  overflow-y: auto !important;<br>}<br>&lt;/style&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/935/0*Uj3GGc-JQzpnml_r.png" /></figure><h3>Vuetify Bottom Sheet v-model</h3><p>We can set up a two-way binding between the value of the v-bottom-sheet and a variable. We can then use this variable to open/close the sheet or to display certain content conditionally.</p><pre>&lt;template&gt;<br>  &lt;v-app&gt;<br>    &lt;div class=&quot;ma-4 text-center&quot;&gt;<br>      &lt;div class=&quot;mb-4&quot;&gt;<br>        The bottom sheet is {{ sheet ? &#39;open&#39; : &#39;closed&#39; }}<br>      &lt;/div&gt;<br>      &lt;v-bottom-sheet<br>        v-model=&quot;sheet&quot;<br>        hide-overlay<br>      &gt;<br>        &lt;template v-slot:activator=&quot;{ on, attrs }&quot;&gt;<br>          &lt;v-btn<br>            v-bind=&quot;attrs&quot;<br>            v-on=&quot;on&quot;<br>            color=&quot;primary&quot;<br>          &gt;<br>            Open Sheet<br>          &lt;/v-btn&gt;<br>        &lt;/template&gt;<br>        &lt;v-sheet<br>          class=&quot;text-center&quot;<br>          height=&quot;200px&quot;<br>        &gt;<br>          &lt;v-btn<br>            class=&quot;mt-6&quot;<br>            text<br>            color=&quot;red&quot;<br>            @click=&quot;sheet = !sheet&quot;<br>          &gt;<br>            close<br>          &lt;/v-btn&gt;<br>          &lt;div class=&quot;my-3&quot;&gt;This is a bottom sheet&lt;/div&gt;<br>        &lt;/v-sheet&gt;<br>      &lt;/v-bottom-sheet&gt;<br>    &lt;/div&gt;<br>  &lt;/v-app&gt;<br>&lt;/template&gt;</pre><pre>&lt;script&gt;<br>export default {<br>  name: &#39;App&#39;,<br>  data: () =&gt; ({<br>    sheet: false,<br>  }),<br>};<br>&lt;/script&gt;</pre><pre>&lt;style&gt;<br>html {<br>  overflow-y: auto !important;<br>}<br>&lt;/style&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/932/0*KrkygYuFPM8ghgjA.gif" /></figure><h3>Beautify with Vuetify</h3><p>The complete guide to creating elegant web apps with the Vuetify Material Design framework.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/980/1*nToGOX_J9RYhMtjJ87w7fw.png" /></figure><h3>Persistent Bottom Sheets</h3><p>By default, an open bottom sheet closes when another element is clicked:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/932/0*O2oXTBwZsRTo0wa1.gif" /></figure><p>We can prevent this by setting the persistent prop to true on the v-bottom-sheet:</p><pre>&lt;template&gt;<br>  &lt;v-app&gt;<br>    &lt;div class=&quot;ma-4 text-center&quot;&gt;<br>      &lt;v-bottom-sheet<br>        v-model=&quot;sheet&quot;<br>        persistent<br>      &gt;<br>        &lt;template v-slot:activator=&quot;{ on, attrs }&quot;&gt;<br>          &lt;v-btn<br>            v-bind=&quot;attrs&quot;<br>            v-on=&quot;on&quot;<br>            color=&quot;primary&quot;<br>          &gt;<br>            Open Sheet<br>          &lt;/v-btn&gt;<br>        &lt;/template&gt;<br>        &lt;v-sheet<br>          class=&quot;text-center&quot;<br>          height=&quot;200px&quot;<br>        &gt;<br>          &lt;v-btn<br>            class=&quot;mt-6&quot;<br>            text<br>            color=&quot;red&quot;<br>            @click=&quot;sheet = !sheet&quot;<br>          &gt;<br>            close<br>          &lt;/v-btn&gt;<br>          &lt;div class=&quot;my-3&quot;&gt;This is a bottom sheet.&lt;/div&gt;<br>        &lt;/v-sheet&gt;<br>      &lt;/v-bottom-sheet&gt;<br>    &lt;/div&gt;<br>  &lt;/v-app&gt;<br>&lt;/template&gt;</pre><pre>&lt;script&gt;<br>export default {<br>  name: &#39;App&#39;,<br>  data: () =&gt; ({<br>    sheet: false,<br>  }),<br>};<br>&lt;/script&gt;</pre><pre>&lt;style&gt;<br>html {<br>  overflow-y: auto !important;<br>}<br>&lt;/style&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/932/0*BoX5Dj4us54eNSCw.gif" /></figure><h3>Vuetify Bottom Sheet Inset</h3><p>The inset prop reduces the maximum width of the v-bottom-sheet to 70% on larger screens. We can also use the width prop to reduce the width manually.</p><pre>&lt;template&gt;<br>  &lt;v-app&gt;<br>    &lt;div class=&quot;ma-4 text-center&quot;&gt;<br>      &lt;v-bottom-sheet<br>        v-model=&quot;sheet&quot;<br>        inset<br>      &gt;<br>        &lt;template v-slot:activator=&quot;{ on, attrs }&quot;&gt;<br>          &lt;v-btn<br>            v-bind=&quot;attrs&quot;<br>            v-on=&quot;on&quot;<br>            color=&quot;primary&quot;<br>          &gt;<br>            Open Sheet<br>          &lt;/v-btn&gt;<br>        &lt;/template&gt;<br>        &lt;v-sheet<br>          class=&quot;text-center&quot;<br>          height=&quot;200px&quot;<br>        &gt;<br>          &lt;v-btn<br>            class=&quot;mt-6&quot;<br>            text<br>            color=&quot;red&quot;<br>            @click=&quot;sheet = !sheet&quot;<br>          &gt;<br>            close<br>          &lt;/v-btn&gt;<br>          &lt;div class=&quot;my-3&quot;&gt;This is a bottom sheet.&lt;/div&gt;<br>        &lt;/v-sheet&gt;<br>      &lt;/v-bottom-sheet&gt;<br>    &lt;/div&gt;<br>  &lt;/v-app&gt;<br>&lt;/template&gt;</pre><pre>&lt;script&gt;<br>export default {<br>  name: &#39;App&#39;,<br>  data: () =&gt; ({<br>    sheet: false,<br>  }),<br>};<br>&lt;/script&gt;</pre><pre>&lt;style&gt;<br>html {<br>  overflow-y: auto !important;<br>}<br>&lt;/style&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/935/1*ONTUDqNYC4sxmLa210U1-w.png" /></figure><h3>Creating an “Open In” Component</h3><p>We can combine a functional <a href="https://codingbeautydev.com/blog/vuetify-list/">list</a> and bottom sheet to create an “open in” component.</p><pre>&lt;template&gt;<br>  &lt;v-app&gt;<br>    &lt;div class=&quot;ma-4 text-center&quot;&gt;<br>      &lt;v-bottom-sheet v-model=&quot;sheet&quot;&gt;<br>        &lt;template v-slot:activator=&quot;{ on, attrs }&quot;&gt;<br>          &lt;v-btn<br>            v-bind=&quot;attrs&quot;<br>            v-on=&quot;on&quot;<br>            color=&quot;green&quot;<br>            dark<br>          &gt;<br>            Open in<br>          &lt;/v-btn&gt;<br>        &lt;/template&gt;<br>        &lt;v-list&gt;<br>          &lt;v-subheader&gt;Open in&lt;/v-subheader&gt;<br>          &lt;v-list-item<br>            v-for=&quot;(app, i) in apps&quot;<br>            :key=&quot;i&quot;<br>            @click=&quot;sheet = false&quot;<br>          &gt;<br>            &lt;v-list-item-title&gt;{{ app }}&lt;/v-list-item-title&gt;<br>          &lt;/v-list-item&gt;<br>        &lt;/v-list&gt;<br>      &lt;/v-bottom-sheet&gt;<br>    &lt;/div&gt;<br>  &lt;/v-app&gt;<br>&lt;/template&gt;</pre><pre>&lt;script&gt;<br>export default {<br>  name: &#39;App&#39;,<br>  data: () =&gt; ({<br>    sheet: false,<br>    apps: [&#39;Firefox&#39;, &#39;Chrome&#39;, &#39;Edge&#39;, &#39;Opera&#39;],<br>  }),<br>};<br>&lt;/script&gt;</pre><pre>&lt;style&gt;<br>html {<br>  overflow-y: auto !important;<br>}<br>&lt;/style&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/932/0*uURmdi1_JFVZT8Ep.gif" /></figure><h3>Conclusion</h3><p>Bottom sheets are anchored to the bottom of the screen and can be used to display supplementary content. Vuetify provides the Vuetify bottom sheet component (v-bottom-sheet) for creating and customizing them.</p><h3>Upgrade Your Skills</h3><p>Get new web development tips and tutorials every week.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KLG9Wxq6Sqt3jxTaL00Tnw.png" /></figure><p><a href="https://codingbeautydev.com/newsletter/"><strong>Subscribe</strong></a></p><p>Get a free copy <a href="https://mailchi.mp/583226ee0d7b/beautify-with-vuetify"><strong>here</strong></a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=30f74e0e644b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codingbeauty-tutorials/vuetify-bottom-sheet-30f74e0e644b">How to Use the Vuetify Bottom Sheet Component</a> was originally published in <a href="https://medium.com/codingbeauty-tutorials">Coding Beauty Tutorials</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Use the JavaScript Nested Ternary Operator]]></title>
            <link>https://medium.com/codingbeauty-tutorials/javascript-nested-ternary-operator-dc28551fb8c3?source=rss----4898fe0f97c2---4</link>
            <guid isPermaLink="false">https://medium.com/p/dc28551fb8c3</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[Tari Ibaba]]></dc:creator>
            <pubDate>Tue, 01 Aug 2023 22:44:58 GMT</pubDate>
            <atom:updated>2023-08-01T22:44:34.453Z</atom:updated>
            <content:encoded><![CDATA[<h3>How to use the JavaScript nested ternary operator</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BoDyPNKEBgfLaYBpV_w3yA.png" /></figure><p>As you might know, ternary operators in JavaScript are a single statement alternative to if…else statements frequently used to make code more concise and easier to understand. For example, we could have a function that returns “yes” or “no” depending on whether a number passed to it is odd or not.</p><pre>function isOdd(num) {<br>  if (num % 2 === 1) return &#39;yes&#39;;<br>  else return &#39;no&#39;;<br>}</pre><p>We can refactor the isOdd function to use a one-line conditional statement like this:</p><pre>function isOdd(num) {<br>  return num % 2 === 1 ? &#39;yes&#39; : &#39;no&#39;;<br>}</pre><h3>Nested ternary operator in JavaScript</h3><p>We can nest a ternary operator as an expression inside another ternary operator. We can use this to replace if…else if…else statements and switch statements.</p><p>For example, we could have a piece of code that sets the English word for the numbers 1, 2, and 3 to a variable. With if…else if…else:</p><pre>let num = 1;<br>let word;</pre><pre>if (num === 1) word = &#39;one&#39;;<br>else if (num === 2) word = &#39;two&#39;;<br>else if (num === 3) word = &#39;three&#39;;<br>else num = &#39;unknown&#39;;</pre><p>With switch…case:</p><pre>let num = 1;<br>let word;</pre><pre>switch (num) {<br>  case 1:<br>    word = &#39;one&#39;;<br>    break;<br>  case 2:<br>    word = &#39;two&#39;;<br>    break;<br>  case 3:<br>    word = &#39;three&#39;;<br>    break;<br>  default:<br>    word = &#39;unknown&#39;;<br>    break;<br>}</pre><p>And now with nested ternary operators:</p><pre>let num = 1;<br>let word =<br>  num === 1<br>    ? &#39;one&#39;<br>    : num === 2<br>    ? &#39;two&#39;<br>    : num === 3<br>    ? &#39;three&#39;<br>    : &#39;unknown&#39;;</pre><p>The above code example works exactly like the previous two and is less cluttered. Notice we are now able to declare and set the variable in the same statement with this nested ternary approach.</p><p><em>Updated at: </em><a href="https://codingbeautydev.com/blog/javascript-nested-ternary-operator/"><em>codingbeautydev.com</em></a></p><h3>Every Crazy Thing JavaScript Does</h3><p>Just when you thought you knew all the quirks.<br>Equip yourself with armor to dodge painful bugs and save valuable time with <strong>Every Crazy Thing JavaScript Does, </strong>a captivating guide to the subtle caveats and lesser-known parts of JavaScript.</p><p><strong>Get a free copy </strong><a href="https://cbdev.link/d3c4eb"><strong>here</strong></a><strong> today.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/350/1*YS5Oub8REWy8vnOEqBnsyQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dc28551fb8c3" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codingbeauty-tutorials/javascript-nested-ternary-operator-dc28551fb8c3">How to Use the JavaScript Nested Ternary Operator</a> was originally published in <a href="https://medium.com/codingbeauty-tutorials">Coding Beauty Tutorials</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to fix the “Unexpected strict mode reserved word ‘yield’” error in JavaScript]]></title>
            <link>https://medium.com/codingbeauty-tutorials/javascript-unexpected-reserved-word-yield-3a4a3400fb46?source=rss----4898fe0f97c2---4</link>
            <guid isPermaLink="false">https://medium.com/p/3a4a3400fb46</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Coding Beauty Tutorials]]></dc:creator>
            <pubDate>Wed, 26 Jul 2023 02:19:16 GMT</pubDate>
            <atom:updated>2023-07-26T02:18:53.523Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cdaSHcy9Y41ln8uKUqUHUQ.png" /></figure><p>The “Unexpected strict mode reserved word ‘yield’” syntax error happens in JavaScript when you use the yield keyword outside a generator function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/529/0*GmNDD_UXfAptF6Z7.png" /></figure><p>Here’s an example of the error happening in code:</p><p>JavaScript</p><pre>function* numberGen() {<br>  // ❌ SyntaxError: Unexpected strict mode reserved word &#39;yield&#39;<br>  yield 2;<br>  yield 4;<br>}<br><br>const gen = numberGen();<br>console.log(gen.next().value);<br>console.log(gen.next().value);</pre><p><strong>Note:</strong> As this is a syntax error, we don’t need to call the function for it to happen, and no part of the code runs until we fix it.</p><p>To fix the “SyntaxError unexpected strict mode reserved word ‘yield’” error, ensure that the innermost enclosing function containing the yield keyword is a generator function.</p><p>JavaScript</p><pre>function* numberGen() {<br>  // ✅ Runs successfully - no error<br>  yield 2;<br>  yield 4;<br>}<br><br>const gen = numberGen();<br><br>console.log(gen.next().value); // 2<br>console.log(gen.next().value); // 4</pre><p>We create generator functions with function*; the * must be there.</p><h3>Make sure innermost function is generator function</h3><p>A common reason why the “Unexpected strict mode reserved word ‘yield’” happens is using yield in an inner function that&#39;s in a generator function.</p><p>This could be a callback or closure.</p><p>JavaScript</p><pre>function* numberGen() {<br>  return () =&gt; {<br>    for (let i = 0; i &lt; 30; i += 10) {<br>      // ❌ SyntaxError: Unexpected strict mode reserved word &#39;yield&#39;<br>      yield i;<br>    }<br>  }<br>}<br><br>const gen = numberGen()();<br>console.log(gen.next().value);<br>console.log(gen.next().value);</pre><p>You may think the outer function* will let the yield work, but nope - it doesn&#39;t!</p><p>You have to make the innermost function a generator:</p><p>JavaScript</p><pre>function numberGen() {<br>  return function* () {<br>    for (let i = 0; i &lt; 30; i += 10) {<br>      // ✅ Runs successfully - no error<br>      yield i;<br>    }<br>  };<br>}<br><br>const gen = numberGen()();<br>console.log(gen.next().value);  // 10<br>console.log(gen.next().value);  // 20</pre><p>Note we removed the * from the outer one, so it acts like a normal function and returns the generator.</p><p>Also we change the arrow function a normal one, because arrow functions can’t be generators.</p><p>Here’s another example, seen <a href="https://stackoverflow.com/questions/33316765/why-is-es6-yield-a-reserved-word-when-called-in-this-context">here</a>:</p><p>JavaScript</p><pre>function* generator() {<br>  const numbers = [1, 2, 3, 4, 5];<br>  // ❌ SyntaxError: Unexpected strict mode reserved word<br>  numbers.map((n) =&gt; yield(n + 1));<br>}<br><br>for (const n of generator()) {<br>  console.log(n);<br>}</pre><p>Here the goal was to consume the generator in the for loop, printing out each number one by one.</p><p>But the callback is the innermost function that has the yield, and it&#39;s not a generator. Let&#39;s fix this:</p><p>JavaScript</p><pre>function* generator() {<br>  const numbers = [1, 2, 3, 4, 5];<br>  // ✅ Runs successfully - no error<br>  yield* numbers.map((n) =&gt; n + 1);<br>}<br><br>for (const n of generator()) {<br>  console.log(n);<br>}</pre><h3>yield* keyword</h3><p>Wondering about the * in the yield*? It&#39;s a shorter way of looping through the array and yielding each item.</p><p>A shorter way of this:</p><p>JavaScript</p><pre>function* generator() {<br>  const numbers = [1, 2, 3, 4, 5];<br>  // ✅ Runs successfully - no error<br>  for (const num of numbers.map((n) =&gt; n + 1)) {<br>    yield num;<br>  }<br>}<br><br>for (const n of generator()) {<br>  console.log(n);<br>}</pre><h3>Key takeaways</h3><p>The “Unexpected strict mode reserved word ‘yield’” error can happen in JavaScript when you mistakenly use the yield keyword outside a generator function.</p><p>To fix this error, make sure that the innermost enclosing function containing the yield keyword is actually a generator function.</p><p>One common reason for meeting this error is using yield in an inner function that&#39;s not a generator.</p><p>Remember, the yield* syntax lets us easily loop through an array and yield each item. No need for a traditional for loop with yield statements.</p><p>By understanding and correctly applying these concepts, you can avoid the “Unexpected reserved word ‘yield’” error and ensure smooth execution of your generator functions in JavaScript. Happy coding!</p><h3>Every Crazy Thing JavaScript Does</h3><p>Just when you thought you knew all the quirks!<br>Equip yourself with armor to dodge painful bugs and save valuable time.</p><p>Get <strong>Every Crazy Thing JavaScript Does: </strong>a captivating guide to the subtle caveats and lesser-known parts of JavaScript.</p><p><strong>Grab a free copy </strong><a href="https://cbdev.link/d3c4eb"><strong>here</strong></a><strong> today.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/350/1*YS5Oub8REWy8vnOEqBnsyQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3a4a3400fb46" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codingbeauty-tutorials/javascript-unexpected-reserved-word-yield-3a4a3400fb46">How to fix the “Unexpected strict mode reserved word ‘yield’” error in JavaScript</a> was originally published in <a href="https://medium.com/codingbeauty-tutorials">Coding Beauty Tutorials</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>