What is the difference between String.slice and String.substring?

slice() works like substring() with a few different behaviors. What they have in common: If start equals stop: returns an empty string If stop is omitted: extracts characters to the end of the string If either argument is greater than the string’s length, the string’s length will be used instead. Distinctions of substring(): If start > stop, then substring will swap those 2 arguments. If either argument … Read more

Google Maps API DeletedApiProjectMapError

I have found the solution to the problem. You need to enable both the Google Maps Javascript API, and the Geocoding API. https://console.developers.google.com/projectselector/apis/library and https://console.developers.google.com/google/maps-apis/apis/geocoding-backend.googleapis.com Afterwards the error was RefererNotAllowedMapError instead of DeletedApiProjectMapError, but that was because I was running it on localhost – and it worked on the actual site after I added the domain in Credentials -> Domain Verification.

How to remove all duplicates from an array of objects?

How about with some es6 magic? Reference URL A more generic solution would be: Using the above property strategy instead of JSON.stringify: You can add a wrapper if you want the propNames property to be either an array or a value: allowing both getUniqueItemsByProperties(‘a’) and getUniqueItemsByProperties([‘a’]); Stackblitz Example Explanation Start by understanding the two methods used: filter, findIndex Next take your idea of what … Read more

How does AJAX work?

If you are totally new to AJAX (which stands for Asynchronous Javascript And XML), the AJAX entry on wikipedia is a good starting point: Like DHTML and LAMP, AJAX is not a technology in itself, but a group of technologies. AJAX uses a combination of: HTML and CSS for marking up and styling information. The DOM accessed … Read more

What language is JavaScript written in?

Javascript is just a standard, more formally known as ECMAScript. It can be implemented in any language, just like any standard. Chrome’s Javascript engine, V8, is written in C++. From the project page: V8 is written in C++ and is used in Google Chrome, the open source browser from Google. V8 implements ECMAScript as specified in ECMA-262, … Read more

Set value to currency in

Add step=”0.01″ to the <input type=”number” /> parameters: Demo: http://jsfiddle.net/uzbjve2u/ But the Dollar sign must stay outside the textbox… every non-numeric or separator charachter will be cropped automatically. Otherwise you could use a classic textbox, like described here.