<?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[Stories by Sultan Khan on Medium]]></title>
        <description><![CDATA[Stories by Sultan Khan on Medium]]></description>
        <link>https://medium.com/@khansultan1?source=rss-178759721ee6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Stories by Sultan Khan on Medium</title>
            <link>https://medium.com/@khansultan1?source=rss-178759721ee6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 08:21:26 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@khansultan1/feed" 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 I Built a 3D Rubik’s Cube Engine and AI Vision Solver with Flutter]]></title>
            <link>https://medium.com/@khansultan1/how-i-built-a-3d-rubiks-cube-engine-and-ai-vision-solver-with-flutter-5a0ac61981af?source=rss-178759721ee6------2</link>
            <guid isPermaLink="false">https://medium.com/p/5a0ac61981af</guid>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[rubiks-cube]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[apple]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <dc:creator><![CDATA[Sultan Khan]]></dc:creator>
            <pubDate>Tue, 03 Nov 2026 13:38:28 GMT</pubDate>
            <atom:updated>2026-11-03T13:38:28.140Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CrkQ8V1PI9BU9BXxq43ClQ.png" /><figcaption>CubeKing 3D</figcaption></figure><p>Over 450 million Rubik’s cubes have been sold worldwide. Yet, studies estimate that <strong>less than 5% of people who buy one ever figure out how to solve it</strong>.</p><p>When I looked at the mobile app landscape for twisty puzzles, I noticed a frustrating divide:</p><ol><li><strong>Clunky 2D Simulators:</strong> Flat, unintuitive, and filled with intrusive interstitial ads every 30 seconds.</li><li><strong>Fragile Solvers:</strong> Apps that break if your room lighting is slightly warm or if you tilt your phone by 10 degrees.</li><li><strong>Missing Exotic Shapes:</strong> Almost none supported shape-shifting puzzles like the <strong>Mirror Cube</strong> or the 12-sided <strong>Megaminx</strong>.</li></ol><p>I set out to build <strong>CubeKing 3D</strong> (<a href="https://apps.apple.com/app/id6810142785">iOS</a> / <a href="https://play.google.com/store/apps/details?id=com.app.games.cubeking3d">Android</a>): an open, high-performance 3D twisty puzzle sandbox and real-life AI camera solver built completely with <strong>Flutter</strong>.</p><p>Here is how the 3D graphics pipeline, quaternion mathematics, and computer vision architecture work under the hood.</p><h3>1. The Mathematics of 3D Twisty Puzzles: Why Euler Angles Fail</h3><p>A 3×3×3 Rubik’s cube consists of <strong>26 individual cubies</strong> (8 corners, 12 edges, 6 centers). In a physical cube, turning a face rotates 9 cubies simultaneously by 90 degrees around one of the Cartesian axes (X,Y,ZX, Y, ZX,Y,Z).</p><p>In standard 3D game engines, rotating objects using Euler angles (α,β,γ\alpha, \beta, \gammaα,β,γ) leads directly to <strong>gimbal lock</strong> — a state where two rotational axes align, causing erratic spin behavior during fluid drag gestures.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/486/1*IyFGnN-rp73CyBzTc8konA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rzv8KP7Bt2TPa_J8rVmK2Q.png" /></figure><h3>The Arcball Touch Layer</h3><p>When the player drags across the screen:</p><ol><li><strong>Raycasting</strong>: A ray is cast from the camera viewport through the touch coordinates (x,y)(x, y)(x,y) onto the 3D cube mesh.</li><li><strong>Layer Filtering</strong>: The engine determines whether the drag vector aligns with a layer slice (U,D,L,R,F,BU, D, L, R, F, BU,D,L,R,F,B) or is an orbital camera drag.</li><li><strong>Quaternion Slerp (Spherical Linear Interpolation)</strong>: During animation, the 9 target cubies interpolate smoothly between their initial rotation and the target 90-degree turn:</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Zn3jpoCURNZKua8glN-Pww.png" /></figure><h3>2. Simulating the Shape-Shifting Mirror Cube</h3><p>Unlike a standard Rubik’s cube where all cubies have identical dimensions and differ only by sticker color, the <strong>Mirror Cube (Bump Cube)</strong> is monochrome (metallic silver/gold) and uses <strong>varying physical heights</strong> along all 3 dimensions.</p><p>When scrambled, the Mirror Cube deforms into an asymmetric, spiky sculpture:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kEEnMF1hWeYyv6zMHQLrhA.png" /></figure><p>To model this in Flutter:</p><ul><li>The permutation group theory remains isomorphic to a standard 3×3×33\times 3\times 33×3×3.</li><li>Each cubie coordinate (i,j,k)∈{−1,0,1}3(i, j, k) \in \{-1, 0, 1\}³(i,j,k)∈{−1,0,1}3 maps to an anisotropic scaling vector: Sijk=[wi,hj,dk]\mathbf{S}_{ijk} = [w_i, h_j, d_k]Sijk​=[wi​,hj​,dk​]</li><li>Hit-testing dynamically evaluates the transformed oriented bounding boxes (OBBs) so that turning deformed protruding layers feels as natural as turning a standard flat cube.</li></ul><h3>3. The AI Camera Solver: Computer Vision on the Edge</h3><p>The most challenging engineering component was the camera scanner (<strong>“Solve My Cube”</strong>). Users point their phone camera at each of the 6 cube faces, and the app must reliably identify sticker colors without requiring a server backend.</p><p>[ Camera Stream (60fps) ]<br> │<br> ▼<br>[ Adaptive 3x3 Perspective Grid Detection ]<br> │<br> ▼<br>[ CIE-Lab Color Space Distance Matching (ΔE*) ]<br> │<br> ▼<br>[ Permutation Parity &amp; Solvability Validation ]<br> │<br> ▼<br>[ Kociemba Two-Phase Optimal Solver (&lt;25 moves) ]</p><h3>Why RGB Fails Under Real-World Lighting</h3><p>Standard RGB Euclidean distance fails when ambient light shifts from cool fluorescent (6500K) to warm incandescent (2700K). Under warm light, white stickers reflect yellow photons, confusing simple classifiers.</p><p>Instead, CubeKing 3D transforms camera pixels into the <strong>CIE-L∗a∗b∗L^*a^*b^*L∗a∗b∗ color space</strong>, where L∗L^*L∗ represents perceptual lightness and a∗,b∗a^*, b^*a∗,b∗ represent chromatic coordinates:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mZNdt4ODkHI-w8EXo1F1Ag.png" /></figure><p>Because human color perception is non-linear, ΔE∗\Delta E^*ΔE∗ enables the classifier to distinguish white from yellow and red from orange even in dimly lit rooms.</p><h3>Solvability Validation</h3><p>Before computing algorithms, the state passes through a strict mathematical validator:</p><ul><li><strong>Corner Permutation Parity</strong>: ∑corner orientations≡0(mod3)\sum \text{corner orientations} \equiv 0 \pmod 3∑corner orientations≡0(mod3)</li><li><strong>Edge Permutation Parity</strong>: ∑edge orientations≡0(mod2)\sum \text{edge orientations} \equiv 0 \pmod 2∑edge orientations≡0(mod2)</li><li><strong>Permutation Parity</strong>: The sign of the corner permutation must match the edge permutation.</li></ul><p>If a sticker was misidentified or peeled off by a user, the app highlights the exact conflicting facelet before wasting compute cycles.</p><h3>4. 9 Exotic Geometries in One App</h3><p>Most mobile apps stop at the classic 3×3. CubeKing 3D ships with <strong>9 distinct puzzle types</strong>:</p><ul><li><strong>Classic Family</strong>: 2×2 (Pocket), 3×3, 4×4 (Master), 5×5 (Professor)</li><li><strong>Shape-Shifting</strong>: Mirror Cube (Bump Cube)</li><li><strong>Polyhedra</strong>: Pyraminx (Tetrahedron), Megaminx (12-sided Dodecahedron)</li><li><strong>Corner-Turning</strong>: Skewb, Dino Cube</li></ul><p>Each puzzle shares the same unified gesture controller, magnetic haptic click feedback, and daily scramble seed generator.</p><h3>5. Experience It Live</h3><p>CubeKing 3D is free to download worldwide:</p><ul><li>🍏 <strong>iOS App Store</strong>: <a href="https://apps.apple.com/app/id6810142785">apps.apple.com/app/id6810142785</a></li><li>🤖 <strong>Google Play Store</strong>: <a href="https://play.google.com/store/apps/details?id=com.app.games.cubeking3d">play.google.com/store/apps/details?id=com.app.games.cubeking3d</a></li></ul><p>If you’re interested in the math or implementation details, drop your questions in the comments!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5a0ac61981af" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Every developer should read this JavaScript survey]]></title>
            <link>https://medium.com/@khansultan1/every-developer-should-read-this-javascript-survey-ba2845a18ed9?source=rss-178759721ee6------2</link>
            <guid isPermaLink="false">https://medium.com/p/ba2845a18ed9</guid>
            <dc:creator><![CDATA[Sultan Khan]]></dc:creator>
            <pubDate>Fri, 24 Jan 2020 13:31:16 GMT</pubDate>
            <atom:updated>2020-01-24T13:31:16.037Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JRgqxhl9eY1tiyLTsHEMvw.jpeg" /></figure><p>The State of JavaScript 2019 report, produced by developers Sacha Greif and Raphael Benitte, is based on a survey of 27,717 JavaScript developers worldwide, who weighed in on everything from JavaScript language features and flavors to frameworks, utilities, editors, and testing tools. In highlights of the report:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/264/1*NcC7iA16Qz2T6ftLfwXhhQ.jpeg" /></figure><ul><li>58.5 percent of respondents said they had used TypeScript and would use it again.</li><li>The destructuring assignment syntax was used by 85.1 percent of respondents.</li><li>35.8 percent of respondents had used the Angular JavaScript framework but would not use it again. Only 21.9 percent said they had used Angular and would continue to do so. Dissatisfaction with Angular has risen dramatically since the 2017 report.</li><li>71.7 percent of respondents had used the React JavaScript UI library and would do so again.</li><li>71.6 percent said they had used the Express Node.js framework and would use it again.</li><li>50.6 percent of respondents had heard of the GraphQL query language and execution engine and wanted to learn it, while 38.7 percent had used it and wanted to use it again.</li><li>Electron, a tool for building cross-platform desktop apps with JavaScript, HTML, and CSS, was used by 25.6 percent of respondents who also responded that they would use it again. But Electron trailed React Native framework (27.2 percent) in this regard.</li><li>For JavaScript testing, 61.2 percent had used Jest and would do so again.</li><li>Async/await functions are a popular JavaScript feature, with 89.3 percent of those aware of it having used it.</li><li>JavaScript promises have been used by nearly 95 percent of the 20,543 developers who said they were aware of it.</li><li>The Local Storage browser API was used by 89.5 percent of the 20,021 developers who were aware of it.</li><li>JavaScript typed arrays were used by 28.1 percent of respondents while 35.4 percent knew of it but had not used it.</li><li>Service workers, which act as proxy servers sitting between web applications, the browser, and the network, have not been used by 54 percent of respondents who were aware of them.</li></ul><p><strong>Source:</strong> <a href="https://www.infoworld.com/article/3509588/webassembly-hasnt-grabbed-javascript-developers.html">https://www.infoworld.com/article/3509588/webassembly-hasnt-grabbed-javascript-developers.html</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ba2845a18ed9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why web accessibility is very important for your next application.]]></title>
            <link>https://medium.com/@khansultan1/why-web-accessibility-is-very-important-for-your-next-application-aa57727b7638?source=rss-178759721ee6------2</link>
            <guid isPermaLink="false">https://medium.com/p/aa57727b7638</guid>
            <category><![CDATA[web]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[programming-tips]]></category>
            <category><![CDATA[accessibility]]></category>
            <dc:creator><![CDATA[Sultan Khan]]></dc:creator>
            <pubDate>Mon, 18 Nov 2019 07:50:48 GMT</pubDate>
            <atom:updated>2019-11-18T07:50:48.323Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tbgejKqw9pc3T0RZU3m-Tg.png" /></figure><p>Hello friends!! hope you guys are doing excellent, from the topic itself you know what we’re going to discuss today and why accessibility is very important for your next application.</p><p><strong><em>The power of the Web is in its universality.<br>Access by everyone regardless of disability is an essential aspect.</em></strong></p><p>Tim Berners-Lee, W3C Director and inventor of the World Wide Web</p><p>The web is designed to work for all people regardless of who might be outside the narrow range of the “typical” user, who might access or interact with things differently than you expect. Specifically, it concerns users who are experiencing some type of impairment or disability — and bear in mind that that experience might be non-physical or temporary.</p><p>Web accessibility depends on several components working together, including web technologies, web browsers and other “user agents”, authoring tools, and websites.</p><p>Let’s take an example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/575/1*4-r9532R5Yfq7vwsjDCsVg.jpeg" /></figure><p>The above form has several accessibility issues.</p><ol><li>The text has a lower contrast, which is hard for low-vision users to read.</li><li>Having labels on the left and fields on the right makes it hard for many people to associate them</li><li>The “Remember details?” label isn’t associated with the checkbox</li></ol><p>Now let’s wave our accessibility wand and see the form with those issues fixed</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/575/1*6hs_U7nbzaDzW-lk9xuXSw.jpeg" /></figure><p>Which would you rather use? If you said “the accessible version”, you’re on your way to understanding the main premise of this guide. Often, something that’s a complete blocker for a few users is also a pain point for many others, so by fixing the accessibility issue you improve the experience for everyone.</p><p>Here’s a rundown of some crucial guidelines to follow for modern web accessibility:</p><ol><li>Text alternatives and captions for non-text media (videos and images)</li><li>Allow users to traverse the page with only the keyboard</li><li>Give users control over which features to load or change</li><li>Design page text with sufficient contrast</li></ol><h3>Evaluating Accessibility</h3><p>When developing or redesigning a website, evaluate accessibility early and throughout the development process to identify accessibility problems early, when it is easier to address them. Simple steps, such as changing settings in a browser, can help you evaluate some aspects of accessibility. Comprehensive evaluation to determine if a website meets all accessibility guidelines takes more effort.</p><h3>Conclusion</h3><p>Hope you enjoyed reading this article the conclusion of this article is to make a contrast about accessibility and why it’s important, being a developer we’ve to think out of the box and make our next application accessible for everyone, for more details information about web accessibility you can check a great tutorial designed by google.</p><p><a href="https://developers.google.com/web/fundamentals/accessibility">Accessibility | Web Fundamentals | Google Developers</a></p><p>you can also check a great tutorial <a href="https://aerolab.co/blog/web-accessibility">https://aerolab.co/blog/web-accessibility</a></p><p>if you really enjoyed please hit the clap icon and leave a comment if you have any questions and concerns.</p><p>Thanks for reading :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aa57727b7638" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What’s New In TypeScript 3.7 Release]]></title>
            <link>https://medium.com/@khansultan1/whats-new-in-typescript-3-7-release-8522eafffab1?source=rss-178759721ee6------2</link>
            <guid isPermaLink="false">https://medium.com/p/8522eafffab1</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[typescript]]></category>
            <dc:creator><![CDATA[Sultan Khan]]></dc:creator>
            <pubDate>Wed, 13 Nov 2019 08:07:26 GMT</pubDate>
            <atom:updated>2019-11-13T08:07:26.278Z</atom:updated>
            <content:encoded><![CDATA[<h3>What’s new in TypeScript 3.7 release</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9eMyWLYOqU5aqBtVoFoi3Q.jpeg" /></figure><p>Hello Friends, hope you’re doing great, I know many of the developers love TypeScript and I’m here to let you know the new surprises Microsoft has announced in the new 3.7 TypeScript version, there are many cool features which we’re really waiting for it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*F7joUIhvmcjrMGA7t-bSiw.gif" /></figure><h3>Optional Chaining</h3><p>TypeScript 3.7 implements one of the most highly-demanded ECMAScript features yet: optional chaining let’s have a look at how it works!</p><pre>let x = foo?.bar.baz();</pre><p>the above code is the same as:</p><pre>let x = (foo === null || foo === undefined) ?<br>    undefined :<br>    foo.bar.baz();</pre><p>another example</p><pre>// Before<br>if (foo &amp;&amp; foo.bar &amp;&amp; foo.bar.baz) {<br>    // ...<br>}<br><br>// After-ish<br>if (foo?.bar?.baz) {<br>    // ...<br>}</pre><h3>Nullish Coalescing</h3><pre>let x = foo ?? bar();</pre><p>this is a new way to say that the value foo will be used when it’s “present”; but when it’s null or undefined, calculate bar() in its place.</p><p>the above code is the same as:</p><pre>let x = (foo !== null &amp;&amp; foo !== undefined) ?<br>    foo :<br>    bar();</pre><h3>Assertion Functions</h3><p>There’s a specific set of functions that throw an error if something unexpected happened. They’re called “assertion” functions. As an example, Node.js has a dedicated function for this called assert.</p><pre>assert(someValue === 42);<br>//or <br>function yell(str) {<br>    assert(typeof str === &quot;string&quot;);<br><br>    return str.toUppercase();<br>    // Oops! We misspelled &#39;toUpperCase&#39;.<br>    // Would be great if TypeScript still caught this!<br>}</pre><p>the above code is the same as:</p><pre>function yell(str) {<br>    if (typeof str !== &quot;string&quot;) {<br>        throw new TypeError(&quot;str should have been a string.&quot;)<br>    }<br>    // Error caught!<br>    return str.toUppercase();<br>}</pre><h3>Better Support for never-Returning Functions</h3><p>In order to ensure that a function never potentially returned undefined or effectively returned from all code paths, TypeScript needed some syntactic signal – either a return or throw at the end of a function. So users found themselves return-ing their failure functions.</p><pre>function dispatch(x: string | number): SomeType {<br>    if (typeof x === &quot;string&quot;) {<br>        return doThingWithString(x);<br>    }<br>    else if (typeof x === &quot;number&quot;) {<br>        return doThingWithNumber(x);<br>    }<br>    return process.exit(1);<br>}</pre><p>Now when these never-returning functions are called, TypeScript recognizes that they affect the control flow graph and accounts for them.</p><p>I hope you enjoyed reading this article this does not end there are many more features Microsoft announce you can read the full article here.</p><p><a href="https://devblogs.microsoft.com/typescript/announcing-typescript-3-7/">Announcing TypeScript 3.7 | TypeScript</a></p><p>Source: <a href="https://devblogs.microsoft.com/typescript/announcing-typescript-3-7/">https://devblogs.microsoft.com/typescript/</a></p><p>Thanks for reading, have a nice day :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8522eafffab1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Top JavaScript Questions and Answers Every Developer Should Know.]]></title>
            <link>https://medium.com/@khansultan1/top-javascript-questions-and-answers-every-developer-should-know-b4463c52fe89?source=rss-178759721ee6------2</link>
            <guid isPermaLink="false">https://medium.com/p/b4463c52fe89</guid>
            <category><![CDATA[questions]]></category>
            <category><![CDATA[interview-questions]]></category>
            <category><![CDATA[ui]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[answers]]></category>
            <dc:creator><![CDATA[Sultan Khan]]></dc:creator>
            <pubDate>Thu, 17 Jan 2019 06:03:24 GMT</pubDate>
            <atom:updated>2019-01-17T06:03:52.264Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/785/1*H-25KB7EbSHjv70HXrdl6w.png" /></figure><p>Hi being a JavaScript developer we’re always crazy to learn frameworks like Angular, React Vue etc.. but the backbone of the all the frameworks is JavaScript, so we must understand JavaScript Deeply before digging into the any framework, I’m always try to think about questions, so I have compiled few of them here, will soon update more questions…</p><p><strong>1) What is object in JavaScript?</strong></p><p>Objects are simply variable but it store data in key value pairs (name and value separated by a colon).<br>example: var obj={name:’medium’}</p><p><strong>2) What is CORS? how does it use?</strong></p><p>CORS is simply Cross-Origin Resource Sharing mean you can share resources (data, web-pages, etc) from outside from the domain or in other word It is a mechanism supported in HTML-5 that manages XMLHttpRequest access to a domain different.</p><p><strong>3) What is DOCTYPE and why it is important?</strong></p><p>Doctype is necessary to make few elements of html work properly. It is a best practice to include the doctype in your html page, if you are not including doctype then browser will work quirks mode(behavior of older browsers).</p><p><strong>4) Difference between typeof &amp; instanceof operators?</strong></p><p><strong>typeof</strong>: By using typeof you get a string of the object type,<br>example: var obj={};<br>console.log(typeof obj);<br>result// ‘object’</p><p><strong>instanceof</strong>: by using instanceof you are comparing the type, specifically if the property of a constructor is in the objects prototype chain.</p><p>example:<br>var obj=function(){}<br>var newobj= new obj();<br>console.log(newobj instanceof obj);<br>result// true</p><p><strong>5) What is prototype ?</strong><br>Every object in Javascript has a prototype. When a messages reaches an object, JavaScript will attempt to find a property in that object first, if it cannot find it then the message will be sent to the object’s prototype and so on, this works just like single parent inheritance in a class based language.</p><p><strong>6) Does javascript have classes?</strong><br>Although the statement “JavaScript has no classes” is correct, JavaScript is object-oriented language, it isn’t a class-based language it’s a prototype-based language.</p><p><strong>7) What will be the output of the following code and why?</strong><br>(function() {<br>console.log(1);<br>setTimeout(function(){console.log(2)}, 1000);<br>setTimeout(function(){console.log(3)}, 0);<br>console.log(4);<br>})();</p><p>Ans: 1,4,3,2</p><p><strong>8) What will be the output of the following code and why?</strong><br>console.log(0.1 + 0.2);<br>console.log(0.1 + 0.2 == 0.3);</p><p>Ans: 0.30000000000000004, false</p><p><strong>9) what will be the output of the following code and why?</strong></p><p>var object={}<br>var object2={}<br>if(object)<br>console.log(object2)<br>else<br>console.log(object===object)</p><p>Ans: {}//object2</p><p><strong>10) create an object using function constructor ?</strong></p><p>function obj(){<br>this.name=’Sultan’,<br>this.age=’25&#39;<br>}<br>var object=new obj();<br>will this work or not<br>obj.gender=’Male’</p><p><strong>11) What will be the output of the following code?</strong><br>var a={},<br>b={key:’b’},<br>c={key:’c’};</p><p>a[b]=123;<br>a[c]=456;</p><p>console.log(a[b]);</p><p>Ans: 456</p><p><strong>12) What is currying in JS?</strong><br>Currying means first few arguments of a function is pre-processed and a function is returned. The returning function can add more arguments to the curried function.</p><p><strong>13) what is web worker?</strong><br>A web worker is a script that runs in the background (i.e., in another thread) without the page needing to wait for it to complete. The user can continue to interact with the page while the web worker runs in the background. Workers utilize thread-like message passing to achieve parallelism.</p><p><strong>14) List some design patterns in JavaScript?</strong><br>Module<br>Prototype<br>Observer<br>Singleton</p><p><strong>15) How to create class in JavaScript?</strong><br>There are many ways you can create class in JavaScript, I am listing out few here,</p><p>1)Using function<br>function Car(type) {<br>this.type = type;<br>this.color = “red”;<br>this.getInfo = getCarInfo;<br>}<br>function getCarInfo;() {<br>return this.color + ‘-’ + this.type ;<br>}</p><p>2)Object literals<br>var Car= {<br>type: “BMW”,<br>color: “white”,<br>getInfo: function () {<br>return this.color + ‘-’ + this.type ;<br>}<br>}<br>console.log(apple.getInfo());</p><p>3)using singleton</p><p>var Car= new function() {<br>this.type = “Maruti”;<br>this.color = “red”;<br>this.getInfo = function () {<br>return this.color + ‘-’ + this.type ;<br>};<br>}<br>console.log(apple.getInfo());</p><p><strong>16) Explain what is bind?</strong></p><p>Bind in JavaScript is a method — Function.prototype.bind . bind is a method. It is called on function prototype. This method creates a function whose body is similar to the function on which it is called but the ‘this’ refers to the first parameter passed to the bind method.</p><p><strong>17) How closure work?</strong><br>A closure is one way of supporting first-class functions; it is an expression that can reference variables within its scope (when it was first declared), be assigned to a variable, be passed as an argument to a function, or be returned as a function result. Or</p><p>A closure is a stack frame which is allocated when a function starts its execution, and not freed after the function returns (as if a ‘stack frame’ were allocated on the heap rather than the stack!).<br>The following code returns a reference to a function:</p><p>function sayHello2(name) {<br>var text = ‘Hello ‘ + name; // Local variable<br>var say = function() { console.log(text); }<br>return say;<br>}<br>var say2 = sayHello2(‘Bob’);<br>say2();</p><p>Thanks for reading :), Please hit clap if you enjoy reading, if you see any kind of dependencies please don’t forget to comment.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b4463c52fe89" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[View love of VueJS in just a second]]></title>
            <link>https://medium.com/@khansultan1/view-love-of-vuejs-in-just-a-second-b5861f5efd28?source=rss-178759721ee6------2</link>
            <guid isPermaLink="false">https://medium.com/p/b5861f5efd28</guid>
            <category><![CDATA[vue]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[vuejs]]></category>
            <category><![CDATA[vue-2]]></category>
            <category><![CDATA[vuex]]></category>
            <dc:creator><![CDATA[Sultan Khan]]></dc:creator>
            <pubDate>Sun, 02 Sep 2018 05:07:19 GMT</pubDate>
            <atom:updated>2018-09-02T05:07:19.170Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*Mfaj72PmdI9N5QanosaEPg.png" /></figure><p>As I said in my previous post, I’m working on the VueJS from last couple of months and I completely fell in love with this framework, whenever I stuck in any point of view I tried google and got a very good response from other developers so I thought other developers are might loving this framework too.</p><p>So I started digging little bit about statics how much people are loving this and I got awesome statistics which I wanted to share with all of you….</p><h3>Github Stars</h3><p>You will see the first snap how much developers started loving this framework, <strong>VueJS </strong>is now a top of the list with <strong>112590 </strong>stars and second is <strong>React </strong>with<strong> 110017</strong> stars and at the same time <strong>AngularJS 58991 and Angular 40116 </strong>stars<strong>.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o5D17Zj-mi_of337mhtsEQ.png" /><figcaption>Github stars till August 2018</figcaption></figure><h3>Google Searches</h3><p>Apart from stars you can easily find the interest over from the 1 year of time on the google searches, have a look at through the blue line indicates <strong>VueJS </strong>and red indicating <strong>ReactJS </strong>and yellow is <strong>Angular.</strong></p><p>Click blow to know more:</p><p><a href="https://trends.google.com/trends/explore?q=Vue,React,Angular">https://trends.google.com/trends/explore?q=Vue,React,Angular</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fx6hxXoBiw7FPoReyfADnw.png" /><figcaption>Interest over time</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*76BZKGkEnkf978CLTqHKQQ.png" /><figcaption>Countries who love most</figcaption></figure><h3><strong>Conclusion</strong></h3><p>I don’t have any words you can easily find all above love from the developers, It’s really fantastic framework ever I’ve worked on.</p><p>If you really enjoy reading please hit clap and finally thanks for reading :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b5861f5efd28" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why VueJS for everyone]]></title>
            <link>https://medium.com/@khansultan1/why-vuejs-for-everyone-7ad92b514289?source=rss-178759721ee6------2</link>
            <guid isPermaLink="false">https://medium.com/p/7ad92b514289</guid>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[vuejs]]></category>
            <category><![CDATA[technology-news]]></category>
            <dc:creator><![CDATA[Sultan Khan]]></dc:creator>
            <pubDate>Thu, 30 Aug 2018 06:39:10 GMT</pubDate>
            <atom:updated>2018-08-30T06:48:46.788Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SHeDp1gSkDjzetIgJoykZg.png" /></figure><p>From last couple of years I’m completely bond with the JavaScript, It’s my daily routine to check JS news or technology feeds everyday and whenever I read any such article I surprised Oh new library!!! oh new framework!!,,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*s4FVTZsaRgJ8ErwbUkH8bw.gif" /></figure><p>Ahh Nah… daily something new :( think about learning everyday some new plugins <strong>jQuery </strong>to <strong>Backbone </strong>to <strong>Ember </strong>to <strong>Angularjs </strong>to <strong>Angular </strong>to <strong>React </strong>to <strong>Vue</strong>, it sounds pretty hard to learn every time new framework or plugins to work on any projects (sometime its cool learning new things),</p><p>If I talk about beginner when they think let’s start learning JavaScript they might see a list of things to learn like Babel, Webpack, React, Grunt, Angular, Meteor, Ember, ES6, Redux, JSX, npm, Typescript, and the list goes on and on... But for beginner all these will nothing make any sense.</p><p>If you are a completely new I would recommend first start with basic JavaScript from <a href="https://developer.mozilla.org/en-US/docs/Learn/Getting_started_with_the_web/JavaScript_basics">https://developer.mozilla.org/en-US/docs/Learn/Getting_started_with_the_web/JavaScript_basics</a></p><p>Back to our topic…</p><p>So from last few months I’m digging into VueJS and found its quite interesting and good comparing to other frameworks so I thought let learn more about it… and started exploring about this framework…..</p><p>and I thought lets share my knowledge to everyone and I started thinking from first question which come everyone’s mind <strong>Why?</strong></p><blockquote>Lets Discuss Why <strong>VueJS</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*PrPwLqI0nEnzlW2aDvLo1Q.gif" /></figure><h3><strong>1) Simplicity:</strong></h3><p>Compare to learning any other framework it’s very easy for new learner to start and building applications from day-1 let’s see what makes this framework easy to start.</p><p>The easiest way to try out Vue.js is using the <a href="https://jsfiddle.net/chrisvfritz/50wL7mdz/">JSFiddle Hello World example</a>. or, you can <a href="https://gist.githubusercontent.com/chrisvfritz/7f8d7d63000b48493c336e48b3db3e52/raw/ed60c4e5d5c6fec48b0921edaed0cb60be30e87c/index.html">create an </a><a href="https://gist.githubusercontent.com/chrisvfritz/7f8d7d63000b48493c336e48b3db3e52/raw/ed60c4e5d5c6fec48b0921edaed0cb60be30e87c/index.html">index.html file</a> and include Vue with:</p><pre>&lt;!-- production version, optimized for size and speed --&gt;<br>&lt;script src=&quot;https://cdn.jsdelivr.net/npm/vue&quot;&gt;&lt;/script&gt;</pre><pre>&lt;script&gt;</pre><pre>//start writing your JavaScript code here</pre><pre>&lt;/script&gt;</pre><pre>&lt;style&gt;</pre><pre>//start writing your css here</pre><pre>&lt;/style&gt;</pre><p>for complete guide please refer <a href="https://vuejs.org/v2/guide/">https://vuejs.org/v2/guide/</a></p><h3>2) Lightweight:</h3><p>A full-featured Vue 2 project with Vuex + Vue Router included (~30KB gzipped) is still significantly lighter than any other frameworks.</p><h3>3) Strong Community:</h3><p>I always thought what happens if I stuck anywhere while my learning journey!!! and found the VueJS community is very helping and a lots of developers love this framework you will easily find solutions on the any community channel like stack overflow etc..</p><h3>4) You can easily integrate other library:</h3><p>You can integrate any other library such as Botstrap, Semetic UI, Meterial UI etc very easily and you feel like you are working from your own pattern ..</p><h3>5) Better code structure:</h3><p>If you are writing your code from old pattern script and common JS or gulp style then this framework give you much easier way to manage your entire code-base and writing better code pattern will help other developer to understand code easily.</p><blockquote>“Any fool can write code that a computer can understand. Good programmers write code that humans can understand.”</blockquote><blockquote>― <strong>Martin Fowler</strong></blockquote><p>I personally recommend the following app structure:</p><ul><li><em>assets // for the assets of the application</em></li><li><em>components // component of the application</em></li><li><em>css // for the CSS files</em></li><li><em>data //for the static data such js language json or other</em></li><li><em>fonts // for the fonts</em></li><li><em>pages // your vue pages</em></li><li><em>services // your data services</em></li><li><em>static // some external plugins or css</em></li></ul><h3>Its not end…..</h3><p>Apart from above there are a lots of good features available in this framework by using this framework you can create complex applications very easily.</p><h3><strong>Features Includes:</strong></h3><blockquote><em>Virtual DOM</em></blockquote><blockquote><em>Data Binding</em></blockquote><blockquote><em>Components</em></blockquote><blockquote><em>Event Handling</em></blockquote><blockquote><em>Animation/Transition</em></blockquote><blockquote><em>Templates</em></blockquote><blockquote><em>Directives</em></blockquote><blockquote><em>Watchers</em></blockquote><blockquote><em>Routing</em></blockquote><blockquote><em>Vue CLI</em></blockquote><blockquote><em>More…..</em></blockquote><h4>Final words</h4><p>I’m very new writer you may feel some grammatical mistake, your feedback and suggestions are welcome,</p><p>please hit clap if you enjoy reading this article.</p><p>Thank you..</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7ad92b514289" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>