Today's Question:  What does your personal desk look like?        GIVE A SHOUT

 JAVASCRIPT


  Remove duplicated elements in JavaScript array

During interviews, one frequent question asked would be something like how to remove duplicated elements in a JavaScript array and how many different ways you can think of. The interviewee would also be asked to write the code down. In real applications, normally front end would not need to handle this case since normally it would be done by backend, but still it's necessary for front end developers to know different ways of doing this.This post will share some of the common ways to remove duplicated elements in JavaScript array.1. ES6 SetIn ES6, there is a new type called Set, The&n...

2,554 0       JAVASCRIPT ARRAY DUPLICATED ELEMENT


  Different ways to pass query parameters in EmberJS

In EmberJS, one could pass query parameters when retrieving resources with store.query() method. But what if there is a requirement that one wants to pass query parameters when calling store.findRecord()? Or there is a requirement that one wants to pass query parameters to a relationship when calling model.get('hasManyAttribute') in a RESTful style? In this post, we will explain how these can be achieved.In the store.query() case, one could easily pass the query parameters by passing a hash to the query method. An example looks like:store.query('someResource', { include: 'someDepend...

9,116 0       RELATIONSHIP QUERY PARAMETERS EMBERJS


  Can a === 1 && a === 2 && a === 3 be true in JavaScript?

Lots of you may be aware that there is famous interview question which asks whether a == 1 && a == 2 && a == 3 can be true in JavaScript. And the answer to this question is YES. The reason is that == will do a non-strict comparison which will evaluate a to a number and this provides the possibility of dynamically return the value when every time a is accessed.Have you ever wondered whether a === 1 && a === 2 && a === 3 can be true? At first glance, it seems this is impossible since === will do strict comparison and the type of the two sides must be the same befo...

5,269 2       JAVASCRIPT === STRICT COMPARISON


  Can a == true && a == false be true in JavaScript?

JavaScript is a weak typed language and it has a loose comparison feature where two objects/values of different type can be compared using == operator. This provides developers great flexibility and confusion at the same time. Before understanding how == works in JavaScript, can you first answer the question in the post title? Can a == true && a == false be true in JavaScript? Normally, we would think that this expression will always return false since a can be either true or false but cannot be both. However, in JavaScript, the above expression can return true indeed.If we h...

19,369 2       JAVASCRIPT COMPARISON INTERVIEW QUESTION ==


  NativeScript-Vue 1.0 Is Finally Out!

After a year of hard work and dedication, NativeScript-Vue 1.0 is finally available in the market. For those who are new to NativeScript- Vue, it is all about a plugin that simply allows one to build native iOS and Android apps with the help of Vue.js. NativeScript-Vue 1.0 is ready for use in production! And it may quite interest you to know that blending of NativeScript and Vue makes it even easier when it comes to building mobile apps. This launch comes with a shiny new website and extensive documentation to make it easier to switch over to NativeScript-Vue.Have you wondered why NativeScript...

1,886 0       JAVASCRIPT VUE.JS HYBRID APP DEVELOPMENT NATIVESCRIPT MOBILE APPLICATION


  Coming up Next for JavaScript Web Apps Is Next.Js 3

Are wondering who is going to be the next PHP of the internet; except JavaScript. Next.js is all set to bring the PHP experience to JavaScript with its latest version. As the technology continues to be considered as a “win” amongst a number of developers across the globe, professionals are trying to improve it as much as they can. Because of its minimalist approach to server-rendered apps, this highly customizable framework can be recommendable for beginners as well as experienced professionals. The newest version, Next.js 3 has, even more, fun goodies to play around with. Dig in! ...

4,772 0       JAVASCRIPT NEXT.JS3


  Convert HTML to DOM elements using JavaScript

In some cases, one would want to convert a HTML string to the DOM elements so that JavaScript can handle them easily. This is frequently used when one get some data from third party APIs where the data is in HTML format.In JavaScript, there are a couple of ways one can use to convert HTML to DOM elements.DOMParserdocument.createElementDOMParserDOMParser can parse XML or HTML source stored in a string into a DOM Document. After the conversion, the normal JavaScript call of handling DOM elements can be used, like getting element by id or using selectors.For example, assuming there...

35,611 1       JAVASCRIPT HTML DOM DOMPARSER DOCUMENT.CREATEELEMENT


  Deep clone of JavaScript object

In JavaScript world, it's frequently seen object clone. Normally when creating a clone of an object, it's only the reference being cloned but not all contents. In some scenarioes, it's desired to clone all the content instead of just the reference such that any change made to the cloned object will not change the original object.Differences between shallow clone and deep clone can be as simple as:Shallow clone : Only the object reference is cloned but not the contentDeep clone : Clone all content, including the content of the object referenced in the objectShallow clone implementationIt's rela...

10,948 0       JAAVSCRIPT SHALLOW COPY DEEP CLONE DEEP COPY SHALLOW CLONE