Javascript

Great article on Duck Typing in JavaScript

Great article on Duck Typing in JavaScript

Found a great article that explains what duck typing is and how it is used in JavaScript. Author makes it very simple to understand with examples. A style of typing in which an object’s methods and properties determine the valid semantics, rather than it’s inheritance from a particular class or implementation of an explicit interface. You can click on the link below to be redirected to that article. Duck Typing in JavaScript

Javascript: Embrace Arrow Functions

Javascript: Embrace Arrow Functions

Great article on JavaScript currying and arrow functions. Here is an example of a function in Javascript: const secret = function (msg) { return function () { return msg; }; }; The same function as currying or arrow function: const secret = msg => () => msg; To learn more about the basics, visit the link below. Source: Familiarity Bias is Holding You Back: It’s Time to Embrace Arrow Functions

Elements of JavaScript Style – JavaScript Scene – Medium

Elements of JavaScript Style – JavaScript Scene – Medium

Great article focusing on Javascript style. Provides some good examples of JavaScript coding styles, practices, and things to avoid. The examples includes: Make the function the unit of composition. One job for each function. Omit needless code. Use active voice. Avoid a succession of loose statements. Keep related code together. Put statements and expressions in positive form. Use parallel code for parallel concepts. Source: Elements of JavaScript Style – JavaScript Scene – Medium

Grails - Adding JavaScript to bottom of page

In Grails using the templating (Sitemesh) if you were to include per-page JavaScript resources then it shows up much earlier in the layout content as part of the <g:layoutBody> Here is an example illustrating the problem: SamplePage.gsp [sourcecode language=“html”] MyThinkPond.com Custom Page ... Some this page content [/sourcecode] and the layout page (layoutPage.gsp) [sourcecode language=“html”] ... Some template (header) content [/sourcecode] results in the following page in browser [sourcecode language=“html”]