<?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 Nagarjun deepak on Medium]]></title>
        <description><![CDATA[Stories by Nagarjun deepak on Medium]]></description>
        <link>https://medium.com/@deepaknagarjun?source=rss-38e634ea216d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*G1tR-B7bXrgmMQpaSf0Bpw.jpeg</url>
            <title>Stories by Nagarjun deepak on Medium</title>
            <link>https://medium.com/@deepaknagarjun?source=rss-38e634ea216d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 13:45:55 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@deepaknagarjun/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[Look]]></title>
            <link>https://medium.com/@deepaknagarjun/look-45a9b5ef0c6c?source=rss-38e634ea216d------2</link>
            <guid isPermaLink="false">https://medium.com/p/45a9b5ef0c6c</guid>
            <category><![CDATA[css]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[html]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Nagarjun deepak]]></dc:creator>
            <pubDate>Fri, 06 Dec 2019 13:45:13 GMT</pubDate>
            <atom:updated>2019-12-06T13:45:13.127Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>JavaScript</strong>:</p><p>· Variables with the let keyword (and const) are hoisted, but unlike var, don’t get initialized. They are not accessible before the line we declare (initialize) them. This is called the “temporal dead zone”. When we try to access the variables before they are declared, JavaScript throws a <strong>Reference Error</strong>.</p><p>· With arrow functions, <strong>this</strong> keyword refers to its current surrounding scope.</p><p>· The <strong>unary</strong> plus tries to convert an operand to a number True is 1, and false is 0. =&gt; +true returns 1.</p><p>· In JavaScript, all objects interact by <strong>reference</strong> when setting them equal to each other.</p><p>· In JavaScript, all <strong>object keys</strong> are strings (unless it’s a Symbol). Even though we might not type them as <strong>strings</strong>, they are always converted into strings under the hood.</p><p>· new <strong>Number()</strong> is a built-in function constructor. Although it looks like a number, it’s not really a number: it has a bunch of extra features and is an object.</p><p>· Functions are objects! (Everything besides primitive types are objects).</p><p>· You can’t add properties to a constructor like you can with regular objects. If you want to add property or method to a constructor use prototype.</p><p>· 3 phases of event propagation: Capturing &gt; Target &gt; Bubbling</p><p>· During the <strong>capturing</strong> phase, the event goes through the ancestor elements down to the target element. It then reaches the <strong>target</strong> element, and <strong>bubbling</strong> begins.</p><p>· JavaScript is a <strong>dynamically typed language</strong>: we don’t specify what types certain variables are. Values can automatically be converted into another type without you knowing, which is called <em>implicit type coercion</em>. <strong>Coercion</strong> is converting from one type into another.</p><p>· True &gt; 7 (typically any number greater than 1) results FALSE since true is 1 and false is 0 in JavaScript.</p><p>· In Objects, FREEZE doesn’t allows you to modify existing property and add new one. Whereas SEAL allows you to modify the existing property but won’t allows you add new one.</p><p>· When testing <strong>equality</strong>, primitives are compared by their <em>value</em>, while objects are compared by their <em>reference</em>. JavaScript checks if the objects have a reference to the same location in memory.</p><p>· eval evaluates codes that&#39;s passed as a string. EX: eval (‘10*6’) which gives you 60.</p><p>· In Objects, if you have two keys with the same name, the duplicate key will be replaced with the last specified value.</p><p>· Target is the element that triggered the event. Current Target is element where event listener attached.</p><p>·</p><p><strong>CSS</strong>:</p><p>Refer HTML/CSS portion: <a href="https://jsbin.com/cuyakix/edit?html,css,output">https://jsbin.com/cuyakix/edit?html,css,output</a></p><p>· ID: it is unique and it can be assigned to only one DOM element at a time. CLASS: it can be assigned to multiple elements on a DOM page. In terms of specificity ID will overtook class because of its uniqueness.</p><p>· POSITION: it requires a parent element to have position set to relative or absolute. FLOAT: it requires parent with clear fix applied and overflow hidden or to be floated itself. Both changes the DOM element flow in a page.</p><p>· DIV SPAN: applies for all the span tags inside the DIV, but DIV &gt; SPAN: applies only to its direct children which is <strong>not</strong> for nested children.</p><p><strong>JQUERY:</strong></p><p>· What is the difference between $(document).ready and window on load: document ready is loaded earliest as HTML is done parsing. Also in window on load you can attach only one listener to it. On other hand document ready can have multiple listeners.</p><p>· HIDE: remove only from visibility but DOM still available it uses CSS display property, REMOVE: actually removes it from DOM tree. DETACH: its similar to REMOVE however its stores the target and its events. It works like when you detach you can assign the element to a variable and append it using the variable.</p><p>·</p><p><strong>Functional Programming in JavaScript: </strong><a href="https://codeprep.io/"><strong>https://codeprep.io/</strong></a></p><p>· <strong>Pure Functions</strong></p><p>A pure function avoids shared state, mutating state and side effects. With a pure function, if you are given the same inputs it always returns the same output.</p><p>· <strong>Shared State</strong></p><p>Any variable or object that exists in a shared scope.</p><p>· <strong>Mutating State</strong></p><p>Mutating is the terminology for changing the value of any item in state. A pure function should not mutate state. Instead it should change a copy of the state item and replace state with this new modified version.</p><p>· <strong>Side Effects</strong></p><p>If a function modifies state this is called a side effect.</p><p><strong>React JS:</strong></p><p>· Why return multiple elements in React is not allowed: React implementation relies on constructing a tree like structure which it uses to for reconciliation. When you return multiple elements from React elements from the render method, the assumption that the tree will have one root node for the Component will no longer hold, hence making it difficult to process reconciliation algorithm.</p><p>· Why do I need import React statement even if I don’t use React explicitly: Using JSX (&lt;App /&gt;) is just a syntactic sugar for React create Element (). So when your code is transpiled to pure JavaScript, references to react will appear there, so you need the import for that. So yes, you’re using it, although you don’t see it.</p><p>· React JS component names must begin with capital letters: n JSX, lower-case tag names are considered to be HTML tags.</p><p>· Request data from API: COMPONENT DID MOUNT.</p><p>· Lifting the state up: it allows to pass data between siblings” to “it allows you to have more pure-presentational components, which make re-usability easier.</p><p>·</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=45a9b5ef0c6c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[JavaScript Q/A]]></title>
            <link>https://medium.com/@deepaknagarjun/javascript-q-a-6eea7305def8?source=rss-38e634ea216d------2</link>
            <guid isPermaLink="false">https://medium.com/p/6eea7305def8</guid>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Nagarjun deepak]]></dc:creator>
            <pubDate>Mon, 02 Dec 2019 09:40:49 GMT</pubDate>
            <atom:updated>2019-12-02T09:40:49.014Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>This article consists of some JavaScript questions and answers asked in web developer interviews. special thanks to <a href="https://medium.com/u/3ba25d382cd1">Adi S</a> for the questions.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*CGtsmzJWpSbT5qGH" /><figcaption>Photo by <a href="https://unsplash.com/@oskaryil?utm_source=medium&amp;utm_medium=referral">Oskar Yildiz</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>1: What is the difference between <em>apply</em> and <em>call </em>in JavaScript?</p><p>The difference is that <em>apply</em> lets you invoke the function with arguments as an array; <em>call </em>requires the parameters be listed explicitly. A useful mnemonic is <em>&quot;</em><strong><em>A</em></strong><em> for </em><strong><em>a</em></strong><em>rray and </em><strong><em>C</em></strong><em> for </em><strong><em>c</em></strong><em>omma.&quot;</em></p><p>theFunction.apply(valueForThis, arrayOfArgs)</p><p>theFunction.call(valueForThis, arg1, arg2, ...)</p><p>2: What is the difference between an <em>object </em>and an <em>array</em>?</p><p>An <strong>Array </strong>has all the features of an object with additional features (you can think of an array like a sub-class of an object) where additional methods and capabilities are added in the Array sub-class. In fact, typeof [] === &quot;object&quot; to further show you that an array is an object.</p><p>The additional features consist of a magic .length property that keeps track of the number of items in the array and a whole slew of methods for operating on the array such as .push(), .pop(), .slice(), .splice(), etc...</p><p>An <strong>Object </strong>gives you the ability to associate a property name with a value as in:</p><pre>var x = {};<br>x.foo = 3;<br>x[&quot;whatever&quot;] = 10;<br>console.log(x.foo);      // shows 3<br>console.log(x.whatever); // shows 10</pre><p>Object properties can be accessed either via the x.foo syntax or via the array-like syntax x[&quot;foo&quot;]. The advantage of the latter syntax is that you can use a variable as the property name like x[myvar] and using the latter syntax, you can use property names that contain characters that Javascript won&#39;t allow in the x.foo syntax.</p><p>A property name can be any string value.</p><p>3: What type of data structure is a <em>stack</em>?</p><p>Stack is a linear data structure which follows a particular order in which the operations are performed. The order may be LIFO(Last In First Out) or FILO(First In Last Out).</p><p>Check out the JS Bin example for more details.</p><p><a href="https://jsbin.com/vedegaw/edit?js,console">JS Bin</a></p><p>4: What type of data structure is a <em>queue</em>?</p><p>A Queue is a linear structure which follows a particular order in which the operations are performed. The order is First In First Out (FIFO).</p><p>Check out the JS Bin example for more details.</p><p><a href="https://jsbin.com/giyojip/edit?js,console">JS Bin</a></p><p>5: What is <em>event delegation</em> in JavaScript?</p><p>DOM event delegation is a mechanism of responding to ui-events via a single common parent rather than each child, through the magic of event “bubbling” (aka event propagation).</p><p>Event bubbling provides the foundation for event delegation in browsers. Now you can bind an event handler to a single parent element, and that handler will get executed whenever the event occurs <em>on any of its child nodes</em> (and any of their children in turn). <strong>This is event delegation.</strong> Here’s an example of it in practice:</p><pre>&lt;ul onclick=&quot;alert(event.type + &#39;!&#39;)&quot;&gt;<br>    &lt;li&gt;One&lt;/li&gt;<br>    &lt;li&gt;Two&lt;/li&gt;<br>    &lt;li&gt;Three&lt;/li&gt;<br>&lt;/ul&gt;</pre><p>6: what is <em>Event Bubbling</em> and <em>Event Capturing</em>?</p><p><strong>Event Bubbling</strong> is the event starts from the <strong>deepest element or target element to its parents, then all its ancestors which are on the way to bottom to top</strong>. At present, all the modern browsers have event bubbling as the default way of event flow.</p><p><strong>Event Capturing</strong> is the event starts from top element to target element. Modern browser doesn’t support event capturing by default but we can achieve that by code in JavaScript.</p><p>7: What is <em>hoisting</em>?</p><p>Hoisting is when the JavaScript interpreter moves all variable and function declarations to the top of the current scope. It’s important to keep in mind that only the actual declarations are hoisted, and that assignments are left where they are.</p><p>Hoisting is done during the interpreter’s first run through the code. Also JavaScript only hoists declarations, not the initialisations.</p><p>will update more…</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6eea7305def8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Async]]></title>
            <link>https://medium.com/@deepaknagarjun/async-79f52a5c81a8?source=rss-38e634ea216d------2</link>
            <guid isPermaLink="false">https://medium.com/p/79f52a5c81a8</guid>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Nagarjun deepak]]></dc:creator>
            <pubDate>Mon, 17 Jun 2019 12:44:34 GMT</pubDate>
            <atom:updated>2019-06-17T12:47:14.285Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>this article formed from <a href="https://medium.com/u/883815d7f29f">Shelley Vohr</a> speech at JS Conf EU 2019.</blockquote><p>let’s say you have a program contained within a single file it’s made up of functions and at any given time only one of these is going to be executing now the rest will execute later at some point in the future that there is the crux of <strong>async.</strong></p><p>It’s the relationship between now and later and the way in which you manage this relationship with your code.Later does not mean strictly and immediately after now it could be at any point in the future and you don’t necessarily know.</p><h4>How code is executed in the JavaScript environment?</h4><p>In pursuit of this understanding it’s best to start with the event loop.</p><p>The event loop can best be conceptualized as an endlessly running singly threaded loop where each iteration runs a small chunk of code in the program.</p><p>If you wanted to run a chunk of code at a later time that chuck would simply be added to the queue for the event loop and when the time came that you desired it to execute it would be dequeued and executed with es6 came a new concept called the micro task queue.</p><h4>Promises</h4><p>promises act as placeholders they allow us to reason about future values without necessarily knowing their outcomes making them functionally extemporaneous when the future value is settled it might succeed or fail and then at that point the promise is no longer a placeholder and becomes an immutable value.</p><h4>*Generators</h4><p>Generators is how they differ from normal functions there are several notable differences but key to generators is their behavior with respect to the run to completion expectation with generators we have a different kind of function which can be paused in the middle either once or several times it is resumed later a which allows other code to run during these pause periods between runs the main strength of generators is that they provide a single threaded synchronous looking code style but allow us to hide the asynchrony away as an implementation detail.</p><p>Async/Await</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5b624327cc75103955e0f22cdba1b1ab/href">https://medium.com/media/5b624327cc75103955e0f22cdba1b1ab/href</a></iframe><p><em>Thanks for reading.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=79f52a5c81a8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Archive #1]]></title>
            <link>https://medium.com/@deepaknagarjun/archive-1-dd86b0fe4b66?source=rss-38e634ea216d------2</link>
            <guid isPermaLink="false">https://medium.com/p/dd86b0fe4b66</guid>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Nagarjun deepak]]></dc:creator>
            <pubDate>Wed, 08 May 2019 12:24:29 GMT</pubDate>
            <atom:updated>2019-05-08T12:24:29.072Z</atom:updated>
            <content:encoded><![CDATA[<p>Learnings:</p><p>Typescript: developed by Microsoft an open source JavaScript language.</p><p>Used for WIN.Js and Angular.Js. help for lock the variables when in traditional JavaScript debug is difficult.</p><p>Used with GRUNT (task runner / complier) and gulp (automatically complier).</p><p>Works well for large projects and good for long term maintenance.</p><p>Typescript is used primarily with Node JS backend language.</p><p>Typescript files cannot be read by browsers so we need compliers.</p><p>Install typescript complier using node JS by npm (node package manager) =&gt; $ npm install — g typescript</p><p><strong>Types</strong> are typical component of typescript.</p><p>Refer: <a href="http://www.typescriptlang.org/docs/handbook/basic-types.html">http://www.typescriptlang.org/docs/handbook/basic-types.html</a></p><p>Vector: An array containing only elements of specified types</p><p>Enum is a type used to store built in variables accessible like keys with reference</p><p>Void returns nothing</p><p><strong>Interfaces </strong>are blueprint of an object. To get the correct error position in the code while using objects.</p><p><strong>Classes</strong> are supercharged blueprint of object. However, it is constructor with reusable components.<br> Refer: <a href="http://www.typescriptlang.org/docs/handbook/classes.html">http://www.typescriptlang.org/docs/handbook/classes.html</a></p><p><strong>Inheritance</strong> is way for objects or classes to gain access to the properties of classes that are possessed by other objects.</p><p><strong>Modules</strong> are powerful way to share code with between files by using modules effectively you can keep your file size small and your dependencies clear.</p><p>In order to combine the two TS files and make it as single js file. In the cmd prompt window $ tsc fileame1.ts filename2.ts –out filename1.js (Note: here filename2 will be the one having module)</p><p>Integration of Typescript with Grunt:</p><p><strong>GITHUB</strong> page you can view the number of issues and stars that library has. From that determine whether to use that or not.</p><p><strong>GRUNT task runner:</strong> Download the TS plugin from grunt page,</p><p>In the terminal window,</p><p>$ npm init and give enter to all the default settings then $ npm install typescript — save</p><p>Now add grunt command line interface $ npm install grunt — save and $ npm install grunt-cli — save</p><p>And $ npm install grunt-ts — save</p><p>Create a file named as gruntfile.js</p><p>And use $ grunt to run the file</p><p>&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;</p><p><strong>let</strong></p><p>var Variables in JavaScript are function scoped. This is different from many other languages (C# / Java etc.) where the variables are block scoped. If you bring a block scoped mindset to JavaScript, you would expect the following to print 123, instead it will print 456:</p><p><em>var foo = 123;</em></p><p><em>if (true) {</em></p><p><em>var foo = 456;</em></p><p><em>}</em></p><p><em>console.log(foo); // 456</em></p><p>This is because {does not create a new variable scope. The variable foo is the same inside the if block as it is outside the if block. This is a common source of errors in JavaScript programming. This is why Typescript (and ES6) introduces the let keyword to allow you to define variables with true block scope. That is if you use let instead of var you get a true unique element disconnected from what you might have defined outside the scope. The same example is demonstrated with let:</p><p><em>let foo = 123;</em></p><p><em>if (true) {</em></p><p><em>let foo = 456;</em></p><p><em>}</em></p><p><em>console.log(foo); // 123</em></p><p>Another place where let would save you from errors is loops.</p><p><em>var index = 0;</em></p><p><em>var array = [1, 2, 3];</em></p><p><em>for (let index = 0; index &lt; array.length; index++) {</em></p><p><em>console.log(array[index]);</em></p><p><em>}</em></p><p><em>console.log(index); // 0</em></p><p>In all sincerity we find it better to use let whenever possible as it leads to lesser surprises for new and existing multi-lingual developers.</p><p>Reference: <a href="https://basarat.gitbooks.io/typescript/docs/let.html">https://basarat.gitbooks.io/typescript/docs/let.html#</a></p><p>06/13/2018:</p><p>Type Inference: var n = 1;</p><p>Type Annotations: var n : Number = 1; explicitly mentioning a data type for a variable.</p><p><strong>NaN — Not a Number</strong></p><p><strong>String Array:</strong></p><p>Like usual JavaScript, in typescript also array index starts @ 0</p><p><strong>Adding Reference of type definition files in Typescript:</strong></p><p>By adding this you can use jQuery comments inside.</p><p>Use this link : <a href="http://definitelytyped.org/">http://definitelytyped.org/</a> — Repository by Boris Yanko — took a respected file from this site and add it to your project directory.</p><p>/// &lt;reference path=”jquery/jquery.d.ts” /&gt;</p><p>Typescript function with required and optional input parameters:</p><p>Refer code plox.</p><p>Typescript function with Arrow functions:</p><p>Refer code plox.</p><p>OBJECTS:</p><p>Objects in typescript is comes in many forms classes, functions, interfaces, object literals and modules.</p><p>Using class:</p><p>Refer code; Folder Name: create a class</p><p>Implementation of class inheritance in typescript:</p><p>Implementing interfaces for multiple classes:</p><p>Refer code; Super used to call the base class also usage of data object helps to get the base class objects.</p><p>Modules:</p><p>Making the internal modules accessible for external usage:</p><p>Creating and accessing nested module:</p><p><strong>ANGULAR JS 2 &amp; TYPESCRIPT:</strong></p><p>In Visual Studio 13 tools =&gt; Nuget Package manager; get the following library packages,</p><p>· Angular JS</p><p>· Angular JS Typescript definitely typed</p><p>Interface hasLocation { location : string; }</p><p>Function showLocation(obj: hasLocation){ alert(obj.hasLocation); }</p><p><strong>Working with Node JS cmd prompt:</strong></p><p>C: or D: = switch over between computer drives.</p><p>cd desktop/foldername = to get inside the folder.</p><p>node app.js = will launch the JS file.</p><p>Refer below link for all types of commands.</p><p>Reference link: <a href="https://www.thomas-krenn.com/en/wiki/Cmd_commands_under_Windows">https://www.thomas-krenn.com/en/wiki/Cmd_commands_under_Windows</a></p><p><strong>Node JS:</strong></p><p>· When you are working with Node JS everything is reference. For example, in below code, you are not making a copy of the first object “arjun” you are just getting reference to the object Arjun.</p><pre><strong>var </strong>arjun = {</pre><pre>    favFood: &quot;Laddu&quot;,</pre><pre>    favMovie: &quot;Inception&quot;</pre><pre>};</pre><pre><strong>var </strong>person = arjun;</pre><pre>person.favFood = &quot;Burger&quot;;</pre><pre>console.log(arjun.favFood);</pre><p><strong>Two and three equal signs:</strong></p><p>Two equal signs: used for whenever you want to compare values.</p><p>Three equal signs: used for whenever you want to compare types and values.</p><p>Keyword THIS refers to whatever thing/object calling it.</p><p><strong>Prototyping:</strong></p><p>Whenever you are importing module never include the dot JS (filename.JS)</p><p>Object factory is basically an object used to create another object — used to avoid sharing module.</p><p>Core Module: While require the core module don’t use the path.<br> Console.log(__dirname);</p><p>Console.log(__filename);</p><p><strong>Creating a Basic Server:</strong></p><pre><strong>var </strong>http = require(&quot;http&quot;);</pre><pre>http.createServer(onRequest).listen(8888);</pre><pre>console.log(&quot;server is running&quot;);</pre><p>Highlighted term onRequest used to, call back or what code you want to run whenever user wants to connect to your server. Which will send them back with a web page or web file or info from our database.</p><p>Listen: server has to be listening for request with a port number (ex: 8888).</p><p>Status code in response write head: 200 — everything ok , 404 — error</p><p>Connect module:</p><p>Open terminal in IDE, npm install connect</p><p>Express framework in Node JS:</p><p>Easy and flexible framework, integrates with many templating engines and contains middleware framework.</p><p>HTML methods/verbs: GET, POST, PUT, DELETE.</p><p>There are various view-engines (basically HTML views) available for Noda JS.</p><p>Ex: Jade template and EJS (Embed JavaScript) where ejs is most commonly used by html users.</p><p><strong>EJS:</strong></p><p>&lt;%= ‘your variable name comes here’ %&gt; — — with equals variable name comes. Variable which is based from js file.</p><p>&lt;% ‘plain JavaScript code’ %&gt; — — without equal sign plain old JavaScript code comes.</p><p>Ex:</p><p>// print five times<br> &lt;% <strong>for</strong>(<strong>var </strong>i = 0; i &lt; 5; i++ ) { %&gt;<br> &lt;p&gt; Hello &lt;/p&gt;<br> &lt;% } %&gt;</p><p><strong>JSON:</strong></p><p>JSON is JavaScript Object Notation which is data storing and interchange. Just a combination of objects.</p><p><strong>MongoDB:</strong></p><p>It’s a no-sql database most commonly it is document database where data or records stored in document formats.</p><p>Create data folder and inside that folder named db where mongo going to save all the data.</p><p>Schema is collection of records based on this. Object contains the various properties of the records.</p><p>Mocha Testing: testing framework to perform tests within our app, test our connection with Database.</p><p>Note: inside package.json file change the test equals to ‘mocha’. Then proceed to testing the db.</p><p>Assert will result in Boolean.</p><p>Es6 default promise library:</p><p>Robo Mongo: gives the visual representation of our data in MongoDB.</p><p><a href="https://robomongo.org/">https://robomongo.org</a></p><p>note: mongoose pluralize our model/collection because it assumes we are going to have more than one records.</p><p>Object ID is unique ID created by MongoDB to each record.</p><p>Find the various update operators and usage in the below link: <a href="https://docs.mongodb.com/manual/reference/operator/update/index.html#id1">https://docs.mongodb.com/manual/reference/operator/update/index.html#id1</a></p><p>Relational Database:</p><p>Books table and Authors table, in MongoDB collection format:</p><p>Author’s ID</p><p>- Name</p><p>- Age</p><p>- Books [Array]</p><p>o Book ID</p><p>§ Title</p><p>§ Pages</p><p>Object Format example:</p><p>{</p><p>Name: ‘Patrick’,</p><p>Age: 30,</p><p>Books: [</p><p>{title: ‘the name of the wind’, pages: 300},</p><p>{title: ‘wise man fear’, pages: 200},</p><p>]</p><p>}</p><p>Nesting with the sub documents:</p><p>Task Runners: Grunt or Gulp JS</p><p><strong>Grunt JS:</strong></p><p>It is a task runner. Which helps us to;</p><p>Performs repetitive tasks, prefix the CSS rules, compiling SASS files into CSS, minify the CSS and JS files also concatenating the files.</p><p><strong>Angular 2 and above:</strong></p><p>Frontend/Client side JavaScript framework which runs on web server. Powerful single page applications.</p><p>MEAN Stack: MongoDB which is no sql database, Express is a backend web framework and Angular and Node are JavaScript Runtimes.</p><p><strong>Components:</strong> Sections of UI can be broken up into encapsulated components. Basic building block of UI. An Angular application is a tree of angular components.</p><p><strong>Services:</strong> Classes that send data and functionality across the components. Ideal place for AJAX call and keep components lean.</p><p>In the new app folder created “e2e” names folder is for end to end testing.</p><p>App.module.ts = it’s a meeting place for everything in your app the services, components and modules.</p><p>Everything added into the NG module and components goes into the declarations, modules like http modules and forms modules goes into imports and services goes into the providers also bootstrap will part of main root component. So literally when you create anything you should bring it into this file.</p><p>App.component.specs.ts = it is meant for testing</p><p>App.component.ts = meant for Components</p><p>Creating a component:</p><p>Command line in node command prompt:</p><p>Ng g component components (which is folder name inside the app) / user (name of the new component you are going to create)</p><p>Fake Online REST API for Testing and Prototyping — <a href="https://jsonplaceholder.typicode.com/">https://jsonplaceholder.typicode.com/</a></p><p><strong>NOTE: </strong>After including services we have to manually add our service into app.module file and it goes into providers and title head.</p><p>Also include the service into component file</p><p>Whenever you use service you have to inject it as dependency parameter which goes into constructor in the component.ts</p><p>Angular -2:</p><p>npm install –g angular-cli =&gt; angular cli in globally.</p><p>npm install –g typescript =&gt; Typescript in globally.</p><p>ng new name of the project =&gt; creates all source files for us.</p><p>ng serve =&gt; which will give the local server and port number.</p><p><a href="https://material.angular.io/">https://material.angular.io</a> =&gt; Materials for Angular</p><p>view encapsulation introduced by angular JS where it eliminates shadow DOM that an HTML element has its separate DOM behind the scenes.</p><p>&lt;ng-content&gt; used to render the component multiple times.</p><p><strong>Data-binding methods:</strong></p><p>1. String Interpolation: {{expression resolving to a string}}</p><p>2. Property Binding: it means sending data to the properties in your html code. There 3 kinds of property binding available.</p><p>&lt;button [disabled]=” expression resolving to required value type”&gt;</p><p>3. Event Binding: it means listen to events emitted from the elements from something. Also you can setup a method to execute.</p><p>&lt;button (click)=” expression handling the event”&gt;</p><p>4. Two-way Data Binding: which made angular popular. Which make bi-directional</p><p>&lt;input [(ng-model)] =” bound model (e.g. object)”&gt;</p><p>Custom bindings for Property and Event bindings:</p><p>Property bindings: @Input() propertyName: string;</p><p>Event bindings: @Output() eventName = new EventEmitter();</p><p>Also please note that input, output and event emitter is within the angular core module so, add that to your import inside angular core line in your code.</p><p>Directives: these are instructions which tell angular to do something. There are 2 types of directives which are</p><p>1. Attribute: interacts with the elements it’s on to change its properties — ex: ngClass.</p><p>2. Structural: changes the structure of the HTML code — ex: *ngIf.</p><p>Pipes “|”: used to change the output data. For example:</p><p>&lt;span [ngStyle]=”{background: ninja.belt}”&gt;{{ninja.belt | uppercase | slice: 1}} Belt&lt;/span&gt;</p><p>It is an example of chaining a pipe events where uppercase first and slicing the output text ninja belt. you can also make custom pipes.</p><p><strong>Services:</strong> ng g s file name,</p><p>Firebase and Fire store with Angular 2:</p><p>RXJS: Reactive Extension JavaScript.</p><p>Ng build –prod =&gt; move to PROD.</p><p>MEAN STACK:</p><p>JWT — JSON Web Tokens — token generations and authentications</p><p>CORS — Cross Origin Resource Sharing — to make request from frontend to backend.</p><p>ODM — Object Document Mapper — MongoDB</p><p>Npm install –g nodemon =&gt; which is used to restart our local host server.</p><p>Use POSTMAN — a google extension used to verify get and post request in the browser localhost itself. Where you can create the json file and verify the results.</p><p>[sudo] npm uninstall -g @angular/cli</p><p>npm cache clean</p><p>[sudo] npm install -g @angular/cli</p><pre>Create component by, ng g c componentname</pre><p>Flash message service issues: <a href="https://stackoverflow.com/questions/48139567/this-flashmessage-show-is-not-a-function">https://stackoverflow.com/questions/48139567/this-flashmessage-show-is-not-a-function</a></p><p>Note: Local storage only can store the values in string not as an object so always use stringify function in JSON.</p><p>Guard: ng generate guard [name]</p><p>CSRF attack on Cookie storage: cross-site request forgery</p><p>_____________________________________________________________________________</p><p>NODE JS &amp; PASSPORT JS LOGIN System:</p><p>A step by step procedure to create a login authentication using NODE JS.</p><p>#1 create package.json file using node JS cli by NPM INIT by doing this give entry point as app.js, and Add below dependencies to your package file and run NPM INSTALL.</p><p>“dependencies”: {<br> “bcryptjs”: “*”,<br> “body-parser”: “*”,<br> “connect-flash”: “*”,<br> “cookie-parser”: “*”,<br> “express”: “*”,<br> “express-messages”: “*”,<br> “express-handlebars”: “*”,<br> “express-session”: “*”,<br> “express-validator”: “*”,<br> “mongodb”: “*”,<br> “mongoose”: “*”,<br> “passport”: “*”,<br> “passport-local”: “*”,<br> “passport-http”: “*”<br> },</p><p>#2 create app.js file in root level. And add the dependencies to the header of the JS file, also set routes</p><p>#3 set view engine and routes as below</p><p><strong>const </strong>routes = require(‘./routes/index’);<br> <strong>const </strong>users = require(‘./routes/users’);<br> <br> // Init the app<br> <strong>const </strong>app = express();<br> <br> // View Engine<br> app.set(‘views’, path.join(__dirname, ‘views’)); =&gt; setting views folder as view model.<br> app.engine(‘handleBars’, exphbs({defaultLayout:’layout’})); =&gt; using handlebar express layout as layout format for our app.<br> app.set(‘view engine’, ‘handlebars’); =&gt; similarly letting handle bar as view engine.</p><p>#3 Adding Middleware (Body parser, Cookie Parser) which are just configuration files.</p><p>Error Formatter for middleware Express-Validator: <a href="https://github.com/VojtaStavik/GetBack2Work-Node/tree/master/node_modules/express-validator#middleware-options">https://github.com/VojtaStavik/GetBack2Work-Node/tree/master/node_modules/express-validator#middleware-options</a></p><p>#4</p><p><strong>REACT JS</strong></p><p>npm i –g create-react-app =&gt; it will create the modules inside App data in system’s C folder and now run.</p><p>ZERO-CONFIG Setup:</p><p>At first, create-react-app react-app =&gt; which will give us the development server (local host for hosting locally), web pack used for bundling the files, babel for compiling the JavaScript code.</p><p>To customize to our production environment run npm run eject.</p><p><strong>NOTES:</strong></p><p>npm start =&gt; starts the development server.</p><p>npm run build =&gt; bundles the app into static files for production.</p><p>npm test =&gt; starts test runner.</p><p>npm run eject =&gt; removes this tool and copies build dependencies, configuration files and scripts into app directory. If you do this, you can’t go back to zero configuration setup.</p><p>Start the app by typing below two commands:</p><p>cd react-app</p><p>npm start</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dd86b0fe4b66" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Useful Front-End L]]></title>
            <link>https://medium.com/@deepaknagarjun/useful-front-end-l-dea40896b194?source=rss-38e634ea216d------2</link>
            <guid isPermaLink="false">https://medium.com/p/dea40896b194</guid>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Nagarjun deepak]]></dc:creator>
            <pubDate>Wed, 08 May 2019 11:47:14 GMT</pubDate>
            <atom:updated>2019-06-11T13:45:18.652Z</atom:updated>
            <content:encoded><![CDATA[<h3>Useful Front-End Links</h3><p><strong>Important links for Learning:</strong></p><p><strong>Full stack Learning</strong>: <a href="https://www.rubysteps.com/so-you-want-to-become-a-full-stack-developer">https://www.rubysteps.com/so-you-want-to-become-a-full-stack-developer</a></p><p><strong>Tutorial Site:</strong> <a href="https://scrimba.com/g/gintrototypescript">https://scrimba.com/g/gintrototypescript</a><br> <strong>Free Code Camp:</strong> <a href="https://learn.freecodecamp.org/">https://learn.freecodecamp.org</a></p><p><strong>Google Analytics</strong> — <strong>SEO</strong> — “<strong><em>Search Engine Optimization</em></strong>”: <a href="https://ga-dev-tools.appspot.com/">https://ga-dev-tools.appspot.com/</a></p><p><strong>SEO Tutorials:</strong> <a href="https://courses.platzi.com/clases/seo-training/">https://courses.platzi.com/clases/seo-training/</a></p><p><strong>Application Programming Interface (API)</strong>: <a href="https://medium.freecodecamp.org/what-is-an-api-in-english-please-b880a3214a82">https://medium.freecodecamp.org/what-is-an-api-in-english-please-b880a3214a82</a></p><p><strong>JavaScript from scratch:</strong> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide">https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide</a></p><p>Fluid HTML templates: <a href="https://htmlburger.com/samples">https://htmlburger.com/samples</a></p><p>A Quick Overview to JavaScript: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/A_re-introduction_to_JavaScript">https://developer.mozilla.org/en-US/docs/Web/JavaScript/A_re-introduction_to_JavaScript</a></p><p>All about JavaScript: <a href="http://javascript.info/">http://javascript.info</a></p><p>JavaScript virtual machine i.e.; JavaScript embedded runner in chrome: <a href="https://developers.google.com/v8/">https://developers.google.com/v8/</a></p><p><em>User authentication JS:</em></p><p><strong>OAuth:</strong> <a href="https://auth0.com/docs/">https://auth0.com/docs/</a></p><p><strong>Passport JS: </strong><a href="http://www.passportjs.org/docs/authenticate/">http://www.passportjs.org/docs/authenticate/</a><br> <strong>Netlify:</strong> GitHub your code and launch your site using this site. link: <a href="https://www.netlify.com/">https://www.netlify.com</a></p><p>Online Best IDE: <a href="https://stackblitz.com/">https://stackblitz.com</a></p><p>Fake Online REST API for Testing and Prototyping — <a href="https://jsonplaceholder.typicode.com/">https://jsonplaceholder.typicode.com/</a></p><p>Find All the Google’s tutorials: <a href="https://codelabs.developers.google.com/">https://codelabs.developers.google.com/</a></p><p>Learn about Material Design: <a href="https://material.io/collections/developer-tutorials/#web">https://material.io/collections/developer-tutorials/#web</a></p><p>Learn Google Analytics: <a href="https://analytics.google.com/analytics/academy/">https://analytics.google.com/analytics/academy/</a></p><p><a href="https://medium.com/unicorn-supplies/angular-vs-react-vs-vue-a-2017-comparison-c5c52d620176">https://medium.com/unicorn-supplies/angular-vs-react-vs-vue-a-2017-comparison-c5c52d620176</a></p><p>Server side rendering for REACT JS =&gt; Next JS for REACT JS: <a href="https://nextjs.org/learn">https://nextjs.org/learn#</a></p><p>Testing of React JS =&gt;JEST JS: <a href="https://jestjs.io/">https://jestjs.io</a></p><p><strong>Learn JSON, AJAX and REST API</strong>: <a href="https://restfulapi.net/">https://restfulapi.net/</a></p><p><strong>D3 JS:</strong></p><p>To create data driven and dynamic interactive models and charts use this Popular JS =&gt; <a href="https://github.com/d3/d3/wiki/Gallery">https://github.com/d3/d3/wiki/Gallery</a></p><p><strong>Ember JS:</strong></p><p>Learn Ember JS = follows the model — view –view model pattern similar to Vue JS =&gt; <a href="https://guides.emberjs.com/release/tutorial/ember-cli/">https://guides.emberjs.com/release/tutorial/ember-cli/</a></p><p>For Awesome Bootstrap Templates: <a href="https://bootswatch.com/">https://bootswatch.com/</a></p><p>Learn how to use Angular CLI =&gt; <a href="https://github.com/angular/angular-cli/wiki">https://github.com/angular/angular-cli/wiki</a></p><p>AUTHO for Angular 2 : <a href="https://github.com/auth0/angular2-jwt">https://github.com/auth0/angular2-jwt</a></p><p><strong>GET YOUR ALL ANGULAR CLI COMMANDS: </strong><a href="https://github.com/angular/angular-cli/wiki"><strong>https://github.com/angular/angular-cli/wiki</strong></a></p><p>Which storage to use for JWT (JSON Web Token) storage: <a href="https://stormpath.com/blog/where-to-store-your-jwts-cookies-vs-html5-web-storage">https://stormpath.com/blog/where-to-store-your-jwts-cookies-vs-html5-web-storage</a></p><p>Error Formatter for middleware Express-Validator: <a href="https://github.com/VojtaStavik/GetBack2Work-Node/tree/master/node_modules/express-validator#middleware-options">https://github.com/VojtaStavik/GetBack2Work-Node/tree/master/node_modules/express-validator#middleware-options</a></p><p>#<strong><em>Application monitoring and crash and bug reporting:</em></strong> <a href="https://github.com/getsentry/sentry">https://github.com/getsentry/sentry</a></p><p>Good site for React Basics Easy Learning: <a href="https://webjustify.com/introduction-to-react/">https://webjustify.com/introduction-to-react/</a></p><p>Creating drag and drop with HTML in build API: <a href="https://developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API">https://developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API</a></p><p>Ruler for your website: <a href="https://www.invisionapp.com/">https://www.invisionapp.com</a></p><p>React Bootstrap: <a href="https://react-bootstrap.github.io/components/alerts/">https://react-bootstrap.github.io/components/alerts/</a></p><p>Updates from June 11th 2019</p><p>Requirements included fading images in/out on mouseover, delete an item from the list, undo a deletion, etc. Additional features included sprite display from an Amazon-provided spritesheet for showing the number of stars on reviews. All in all, it was a pretty good mix of tasks that a front end developer would be required to do on a day-to-day basis. It’s that same stuff I do every day, really, except that the design specifications I usually work from are much nicer looking upon completion. I provided 100% working, validated code exactly to spec in just over two hours, tested locally on MAMP. Despite matching the exact functionality, I failed the test, or missed the point of it, because the result I got back was “we are not moving forward at this time.” Pretty abrupt and non-descript considering the amount of hounding the recruiter engaged in prior to my taking the test.</p><p>What are data- attributes good for? Or why is it better to use translate() rather than a position: absolute Top/Right/Bottom/Left?</p><p>Given a JSON object, build a page of items from that JSON that meets specific design parameters (4 items per row, the color of title, border, margins, padding all according to spec).<br>Describe the box model. Create a drop down menu using jQuery.<br>What does an HTTP request look like?<br>When it is a good time not use “use strict” in JavaScript<br>Implement a function that takes in a list of asynchronous functions and executes the async functions in series. One at a time.</p><p>They asked most of the things related to how JS works, ‘this’ operator works, function prototypes, event delegation etc etc</p><p><a href="https://jkasaudhan.github.io/2017-01-15-fun-with-js/">https://jkasaudhan.github.io/2017-01-15-fun-with-js/</a></p><p><a href="https://github.com/h5bp/Front-end-Developer-Interview-Questions">https://github.com/h5bp/Front-end-Developer-Interview-Questions</a></p><p><a href="https://github.com/getify/You-Dont-Know-JS">https://github.com/getify/You-Dont-Know-JS</a></p><p>but for written exam the experience and creativity of solutions will matter</p><p>MUST:<br><a href="https://eclass.uoa.gr/modules/document/file.php/D21/Introduction.to.Algorithms.CLRS.3rd.Edition.Sep.2009.pdf">https://eclass.uoa.gr/modules/document/file.php/D21/Introduction.to.Algorithms.CLRS.3rd.Edition.Sep.2009.pdf</a></p><p>JS-Path:<br>Learn about types: primitive types and objects.</p><p>Learn about arrays and dates.</p><p>Learn about setTimeout, setInterval</p><p>Learn about prototype chain, how JS looks up properties.</p><p>Learn about async programming — Promise and generator function</p><p>Learn about modern JavaScript features:</p><p>const and let<br>arrow functions<br>async / await<br>import / export<br>dynamic import<br>class</p><p>LINK:<br><a href="https://vijayt.com/post/the-path-to-become-a-good-web-developer/">https://vijayt.com/post/the-path-to-become-a-good-web-developer/</a></p><p><a href="https://leetcode.com/explore/learn/card/binary-search/">https://leetcode.com/explore/learn/card/binary-search/</a></p><p><a href="https://jkasaudhan.github.io/misc/">https://jkasaudhan.github.io/misc/</a></p><p><a href="https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-006-introduction-to-algorithms-fall-2011/lecture-videos/lecture-1-algorithmic-thinking-peak-finding/">https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-006-introduction-to-algorithms-fall-2011/lecture-videos/lecture-1-algorithmic-thinking-peak-finding/</a></p><p><a href="https://www.html5rocks.com/en/tutorials/internals/howbrowserswork/">https://www.html5rocks.com/en/tutorials/internals/howbrowserswork/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dea40896b194" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Web Design:]]></title>
            <link>https://medium.com/@deepaknagarjun/web-design-8af9fe433b77?source=rss-38e634ea216d------2</link>
            <guid isPermaLink="false">https://medium.com/p/8af9fe433b77</guid>
            <category><![CDATA[html]]></category>
            <dc:creator><![CDATA[Nagarjun deepak]]></dc:creator>
            <pubDate>Wed, 03 Apr 2019 13:57:56 GMT</pubDate>
            <atom:updated>2019-04-03T13:57:56.805Z</atom:updated>
            <content:encoded><![CDATA[<p>Web Design:</p><blockquote><em>courtesy</em>: Atomic Design</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eXwRSQq1ZM_LVmBPcU_oYQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8af9fe433b77" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CSR vs SSR]]></title>
            <link>https://medium.com/@deepaknagarjun/csr-vs-ssr-3e3c6c48533d?source=rss-38e634ea216d------2</link>
            <guid isPermaLink="false">https://medium.com/p/3e3c6c48533d</guid>
            <category><![CDATA[server-side-rendering]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[client-side-rendering]]></category>
            <dc:creator><![CDATA[Nagarjun deepak]]></dc:creator>
            <pubDate>Mon, 25 Feb 2019 05:47:41 GMT</pubDate>
            <atom:updated>2019-02-25T05:47:41.897Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dVaUpq9aZbW54GGNE5D1GQ.png" /><figcaption>Server Side Rendering</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*x0L3hiKW3-OAE_TfFzWA5A.png" /><figcaption>Client Side Rendering</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3e3c6c48533d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[React JS]]></title>
            <link>https://medium.com/@deepaknagarjun/react-js-f49d6c5c851d?source=rss-38e634ea216d------2</link>
            <guid isPermaLink="false">https://medium.com/p/f49d6c5c851d</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Nagarjun deepak]]></dc:creator>
            <pubDate>Thu, 29 Nov 2018 06:43:23 GMT</pubDate>
            <atom:updated>2018-11-29T06:43:23.984Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>React JS: </strong><br> <br> Version: 16.4.2 | Documented date: 6th August, 2018.</p><p><strong>Declarative:</strong> React makes it painless to create interactive UIs. Design simple views for each state in your application, and React will efficiently update and render just the right components when your data changes.</p><p>Declarative views make your code more predictable and easier to debug.</p><p><strong>Component-Based:</strong> Build encapsulated components that manage their own state, then compose them to make complex UIs.</p><p>Since component logic is written in JavaScript instead of templates, you can easily pass rich data through your app and keep state out of the DOM.</p><p><strong>Learn Once, Write Anywhere:</strong> We don’t make assumptions about the rest of your technology stack, so you can develop new features in React without rewriting existing code.</p><p>React can also render on the server using Node and power mobile apps using <a href="https://facebook.github.io/react-native/">React Native</a>.</p><p>Render function in the app JS file will have JSX which JavaScript XML code which represents the UI/Output. Babel complier helps to compile the JSX. Refer: <a href="https://babeljs.io/repl">https://babeljs.io/repl</a></p><p>Creating from scratch in SRC folder:</p><p>import <em>React</em> from ‘React’;</p><p>Note: <em>React </em>is object retrieved from the module React.</p><p>Hot module reloading — save the changes the webpage doesn’t need to be refresh.</p><p>JavaScript for React JS:</p><p><strong>Var:</strong></p><p>when you declare a variable in a function it is accessible inside the function it’s Defined.</p><p>For Example:</p><p>function sayHello () {</p><p>for (var i=0; i&lt;=4; i++) {</p><p>console.log(i);</p><p>}</p><p>console.log(i);</p><p>};</p><p>sayHello ();</p><p>to overcome this error in the year 2015, ECMA script introduced the keyword let;</p><p><strong>let and const:</strong></p><p>it is only accessible inside the block. Always go for const whereas let used to reassign the variable.</p><p>Note: variables declared with “var keyword” are scoped to the function and with “let and const keyword” are scoped to the block.</p><p><strong>Objects:</strong></p><p>Collections of key value pairs. In OOPS concept if we have function inside an object we refer that as <strong>Method</strong>. Defining and accessing the object will be,</p><pre>const person = {</pre><pre>name: &#39;Arjun&#39;,</pre><pre>walk () {},</pre><pre>talk () {}</pre><pre>};</pre><pre>// when you know which part to access from the object</pre><pre>person.talk();</pre><pre>// dynamic access like user input changes with object methods in that case use below type</pre><pre>const targetMember = &#39;name&#39;;</pre><pre>person[targetMember.value] = &quot;John&quot;;</pre><p><strong>This:</strong></p><p>In other programming languages (C sharp and Java) the keyword this refers to the Reference of the current Object. Here also it will work like same but, not at all the time.</p><p>Note: every function in the JavaScript is an object.</p><p>Using. bind we can Bind an object with a function. Which will overcome the window object error.</p><pre>const person = {</pre><pre>name: &#39;Arjun&#39;,</pre><pre>walk () {</pre><pre>console.log(this);</pre><pre>}</pre><pre>};</pre><pre>person.walk();</pre><pre>// or</pre><pre>const newWalk = person.walk.bind(person);</pre><pre>newWalk();</pre><p><strong>Arrow Function:</strong></p><p>const square = (number) =&gt; number * number;</p><p>console.log (square (2));</p><p>Note: When we call a function (which is declared inside an object) as a standalone function outside of an object by default “this” returns the window object. To avoid this error and reference to the object use “Self” or use <strong>Arrow function</strong>. Conclude that, arrow functions don’t rebind the this keyword.</p><p>const person = {</p><p>talk () {</p><p>setTimeout (() =&gt; {</p><p>console.log (“this”, this);</p><p>}, 1000)</p><p>}</p><p>};</p><p>person.talk();</p><p><strong>Array.map ():</strong> used to render list of items in React JS. `` before number one in the keyboard used for template literals in ECMA script</p><p>const colors = [‘red’, ‘green’, ‘yellow’];</p><p>const items1 = colors.map((color) =&gt; console.log(color));</p><p>// `` before number one in the keyboard used for template literals in ECMA script</p><p>const items2 = colors.map((color) =&gt; `&lt;li&gt;color&lt;/li&gt;`);</p><p>console.log(items2);</p><p><strong>Object De-structuring:</strong></p><p>const address = {</p><p>street: ‘’,</p><p>city: ‘Madurai’,</p><p>country: ‘’</p><p>};</p><p>const street = address.street;</p><p>const city = address.city;</p><p>const country = address.country;</p><p>// above three lines of code equals to below single line.</p><p>const {street: st, city: ci, country: co} = address;</p><p>console.log(ci);</p><p><strong>Spread Operator:</strong></p><p>It is represented using three dots.</p><p>const first = [1,2,3];</p><p>const second = [4,5,6];</p><p>const combined = […first, ‘a’, …second, ‘b’];</p><p>console.log(combined);</p><p>Result: <em>[1, 2, 3, “a”, 4, 5, 6, “b”]</em></p><p>Usage of spread in an object:</p><p>const person = {</p><p>name: ‘John’</p><p>};</p><p>const position = {</p><p>job: ‘instructor’</p><p>};</p><p>const combined = {…person, …position, location: ‘India’};</p><p>console.log(combined);</p><p>Result:<em> {name: “John”, job: “instructor”, location: “India”}</em></p><p>const clone = {…person};</p><p>console.log(clone);</p><p>Result: <em>{name: “John”}</em></p><p><strong>Classes:</strong></p><p>Note: classes in JavaScript is an object. Because JavaScript <strong>classes are syntactic sugar (makes easier to understand for humans) over constructor functions</strong> and functions basically an object.</p><p>When we have an object with at least one method we need blueprint to create object of that type and that’s when we use Classes. First letter of every class name should be in upper case. “this” keyword inside the constructor always returns a reference. So, whenever the error occurs you only need to look out at class object.</p><p>class Person {</p><p>constructor(name) {</p><p>this.name = name;</p><p>}</p><p>walk () {</p><p>console.log(‘walking’);</p><p>}</p><p>}</p><p>const person = new Person(‘Arjun’);</p><p>console.log(person.name);</p><p>person.walk ();</p><p><strong>Inheritance: “extends”</strong></p><p>If you are adding a separate or custom constructor to a child class, you have to call the constructor in Parent. Use the keyword Super to the argument you receive in the child.</p><p>class Person {</p><p>constructor(name) {</p><p>this.name = name;</p><p>}</p><p>Walk () {</p><p>console.log(‘walking’);</p><p>}</p><p>}</p><p>class Teacher extends Person {</p><p>constructor (name, degree) {</p><p>super(name);</p><p>this.degree = degree;</p><p>}</p><p>teach () {</p><p>console.log(‘Teaching’);</p><p>}</p><p>}</p><p>const teacher = new Teacher (‘Mosh’, ‘B.Sc.’);</p><p>console.log(teacher.name);</p><p>console.log(teacher.degree);</p><p>console.log(teacher.walk());</p><p>console.log(teacher.teach());</p><p><strong>Modules:</strong></p><p>Include the keyword “export” before the classes you want to use in other files, and import the it to where ever you want to use it. Which is called as “Modularized”;</p><p>import {name of the class} from ‘relative file path’;</p><p>Named and Default Exports:</p><p>We can export and import one or more objects from a given module which is known as Named exports.</p><p>Example of Named exports: with no additional keyword on relative JS file.</p><p>import {name of the class} from ‘relative file path’;</p><p>Example of Default exports:</p><p>Add default keyword before the class you want to export.</p><p>@Source:</p><p>export default class Person {</p><p>@Target:</p><p>import Person from ‘relative file path’;</p><p>Note: some of the modules will have both default and named exports, <strong>react</strong> is best example for that.</p><p>— — That’s the end of JavaScript for React Developers. Refer: <a href="https://www.youtube.com/watch?v=NCwa_xi0Uuc">https://www.youtube.com/watch?v=NCwa_xi0Uuc</a> for more contents — -</p><p>Create a new React App:<br> In the cmd prompt, create-react-app ‘name of the app’. Now cd ‘name of the app’ and npm start to launch the local host server.</p><p>Install bootstrap by npm i bootstrap.</p><p><strong>Components:</strong></p><p>JSX expressions must have one parent element. Also it is not a template engine.</p><p>React.Fragment used to avoid additional div elements in your components.</p><p>State is a special property in React component and basically it’s an object that includes any data that this component needs.</p><p>{ } in the html template in-between this curly braces we can write any valid JavaScript expressions.</p><p>Adding attribute to your code: declare it in the state and use in the code with {}. For Ex:</p><p>state = {</p><p>imageUrl: ‘https://picsum.photos/200&#39;</p><p>};</p><p>render () {</p><p>return (</p><p>&lt;div&gt;</p><p>&lt;img src={this.state.imageUrl} alt=”image”&gt;&lt;/img&gt;</p><p>&lt;/div&gt;</p><p>);</p><p>}</p><p>Name of the class attribute is className in react JS. Which is used for bootstrap style property applied to the code. Also you can add custom style by using {{ “CSS default classes with camel case” }}. For ex:</p><p>&lt;div&gt;</p><p>&lt;span style={{ fontSize: 30 }}&gt; Hello World! &lt;/span&gt;</p><p>&lt;/div&gt;</p><p>You can also dynamically change the className.</p><p>getBadgeColor (){</p><p>let badgeColor = “badge m-2 badge-”; // since we are modifing the content</p><p>badgeColor += (this.state.count) === 0 ? “warning” : “primary”;</p><p>return badgeColor;</p><p>}</p><p>Render () {</p><p>Return (&lt;span className={this.GetBadgeColor()}&gt; {this.formatCount()} &lt;/span&gt;</p><p>);</p><p>}</p><p><strong>Rendering the Lists:</strong></p><p>By using arrow map functions. Even though react needs to uniquely identify each item in this list. It is because if the state of this react element and the virtual DOM changes react needs to quickly figure out what element is changed and where in DOM to make changes to keep the Dom in sync with virtual DOM.</p><p>So add Key to list items whenever you are creating list item in the React. Key is unique only for that list.</p><p>Conditional Rendering:</p><p>“operand 1” <strong>&amp;&amp;</strong> “operand 2 (or) a string to print”</p><p>Operand 1 = will be condition which gives the Boolean output.</p><p>If the output of the operand 1 is true it will print the operand 2 / note: it will work like AND gate operator.</p><p>Handling Events:</p><p>All the react elements have properties that are based on standard DOM events (ex: on click, on double click).</p><p>&lt;button onClick = {this.handleIncrement} className=”btn btn-secondary btn-sm”&gt;Increment&lt;/button&gt;</p><p>Note: you don’t need to add () at the end of expression. We are not calling the method just passing the reference to it.</p><p><strong>NOTE:</strong></p><p><strong>setState</strong> ( { } ) method tells the react that we are updating the state and also it will figure out what part of the state is changed and based on that it will bring the DOM in sync with Virtual DOM. Which is also an over rider to existing state object.</p><p>Which is different from angular, ruby and other frameworks because in angular all the browser events are monkey patched so, whenever you type something or click a button it will update the view automatically by its detection algorithm.</p><p>Monkey Patched Events:</p><p>The term <strong>monkey patch</strong> only refers to dynamic modifications of a class or module at runtime. It is reopening the existing classes or methods in class at runtime and changing the behavior, which should be used cautiously.</p><p>Passing Event Arguments:</p><p>Whenever you need to pass an argument to your event handlers simply pass the arrow function here in the body of the function called the event handler and pass an argument.</p><p><strong>Composing Components:</strong></p><p>Pass data, raise and handle events, multiple components in sync, functional components, lifecycle hooks.</p><p>Every react component has a property called <strong>props </strong>and this is basically a plain JavaScript object that includes all the attributes that we set in the component. Ex: value and selected are part of the properties of that <strong>props</strong> object.</p><p>We have special Props called <strong>Children</strong>, we use that when we want to pass something between the opening and closing tag of an element. For example: when we use dialog boxes and we want to render content on the dialog box. It is mostly used at times that you want to pass complex elements to a child component such as a dialog box.</p><p><strong>Debugging React Apps:</strong></p><p>Download the React Developers Tools Extension for chrome, and look in to Developers tools panel window (F12) to look into the react component more easily.</p><p><strong>Props vs State:</strong></p><p>Props includes data that we give to the component whereas State includes data that is local or private to the component So, other components cannot access that state its completely internal to the component. Also Props is read-only we cannot change input to a component inside of that component.</p><p>Which means React won’t allow you to change any properties of the Props Object.</p><p>Events call between two components:</p><p>The component that owns a piece of the state, should be the one modifying it. Which means for example if you want to change or modify an array object inside a state should be done in that component.</p><p><em>The pattern is child component will raise an event and its parent component will handle the event.</em></p><p>Note: Key and ID may look like same but, key was used by React for its own internal purpose of identification. So, we use ID for accessing a div or element.</p><p>Single Source of Truth:</p><p>Remove the local state which is in a separate component.</p><p><strong>Controlled component</strong> which refers to, component doesn’t have a local state it receives all the data via props and raises events whenever data needs to be changed. So, this component entirely depends and controlled by its Parent. In this method your child component will entirely depends on the Props.</p><p>Multiple components in Sync / Lifting the State Up:</p><p>When there is no parent child relationship between two components, but you want to keep both in sync and you want to share the data between them. You need to lift the state up.</p><p>Note: Don’t use constructor in main Parent Component.</p><p>Stateless Functional Component:</p><p>You cannot use lifecycle hooks here. In the case of, a component render function doesn’t have any event handler or state or any helper methods. And you only have single render method for that case; instead of creating a class for that component we can go with arrow functions.</p><p>Note: for these kind of stateless functional component we have to pass props inside an arrow function and also instead of this.props use props directly inside the function.</p><p>Object Destructing:</p><p>Wherever you are having this.props or this.state to replace it use common const of object destructing method. Add it inside the render function. For Ex:</p><p>render () {</p><p>const {counters, onReset, onDelete, onIncrement, onNew} = this.props;</p><p>after this you can use onReset and etc. directly without this.props on front.</p><p>Lifecycle Hooks:</p><p>Our components go through few phases during their lifecycle the first phase is Mounting phase and this is when an instance of a component is created and inserted into the DOM. There are few special methods that we can add to our components and react will automatically call these methods we refer to these methods as lifecycle hooks. They will allow us to hook into certain moments during the lifecycle of a component and do something and the</p><p>1. Mounting phase, we have three lifecycle hooks. 1) Constructor 2) Render 3) component Did Mount. React will call these methods in above mentioned order.</p><p>2. Update phase, it happens when the state or the props of the component get changed. 1) Render 2) Component did update so, whenever we change the state of the component or give it a new props these 2 methods are called in order.</p><p>3. Unmounting Phase, it happens when a component is removed from the DOM. Such as when we delete an object.</p><p>More on this;</p><p>componentDidMount(){</p><p>// AJAX calls</p><p>}</p><p>Component Did Mount method is used to make Ajax calls from the server.</p><p>Component Did Update method is used in case of, optimization for example if the props or state has changed we can do Ajax calls only for that action.</p><p>What’s left pagination, sorting, searching, HTTP, Authentication, Deployment.</p><p>Other things to do:</p><p>#1) Facebook login for our Web Apps: <a href="http://www.developers.facebook.com/apps/">www.developers.facebook.com/apps/</a></p><p>ð Go through API process to create login system to get data from User’s Facebook ID.</p><p>Refer: <a href="https://www.youtube.com/watch?v=ea9KyE78qKI">https://www.youtube.com/watch?v=ea9KyE78qKI</a></p><p>Code: <a href="https://gist.github.com/bradtraversy/815369774ece6ede28a564e2a1e7153a">https://gist.github.com/bradtraversy/815369774ece6ede28a564e2a1e7153a</a></p><p>#2) Loopback API: <a href="https://loopback.io/">https://loopback.io/</a></p><p>ð An IBM API connect. Used to connect API lifecycle from creation to deployment.</p><p>#3) React JS with chart JS: <a href="https://github.com/jerairrest/react-chartjs-2">https://github.com/jerairrest/react-chartjs-2</a></p><p>Used to create various charts in react using chart JS.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/418/1*RtOLRepNXk4CsLgpJfiwzA.png" /></figure><p><strong>Note:</strong> <strong>If you don’t initialize state and you don’t bind methods, you don’t need to implement a constructor for your React component.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f49d6c5c851d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Random Frames]]></title>
            <link>https://medium.com/@deepaknagarjun/random-frames-cf4aa4c2da03?source=rss-38e634ea216d------2</link>
            <guid isPermaLink="false">https://medium.com/p/cf4aa4c2da03</guid>
            <category><![CDATA[script]]></category>
            <category><![CDATA[frames]]></category>
            <category><![CDATA[visualization]]></category>
            <dc:creator><![CDATA[Nagarjun deepak]]></dc:creator>
            <pubDate>Mon, 26 Nov 2018 13:18:47 GMT</pubDate>
            <atom:updated>2018-11-26T13:19:40.665Z</atom:updated>
            <content:encoded><![CDATA[<p>#1 Gun &amp; Face</p><p>the camera is behind the <em>antagonist </em>and showing that he is reaching for his gun which is been kept into the back of his jeans. then he shows it to <em>protagonist. </em>the frame is kept in such way that, <em>protagonist </em>face (capturing facial expressions from him) and the <em>gun.</em></p><p>#2 loading…</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cf4aa4c2da03" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>