How to send an email from JavaScript

You can’t send an email directly with javascript. You can, however, open the user’s mail client: There are also some parameters to pre-fill the subject and the body: Another solution would be to do an ajax call to your server, so that the server sends the email. Be careful not to allow anyone to send … Read more

Convert Array to Object

ECMAScript 6 introduces the easily polyfillable Object.assign: The Object.assign() method is used to copy the values of all enumerable own properties from one or more source objects to a target object. It will return the target object. The own length property of the array is not copied because it isn’t enumerable. Also, you can use … Read more

npm WARN … requires a peer of … but none is installed. You must install peer dependencies yourself

I tried to run a project downloaded from github. Unfortunately, during npm install the following warnings were shown. I tried to change the version based on this question. However, I had a problem, because some packages require multiple versions other packages. Consider these two lines: So, installing some packages causes the list of dependencies to … Read more

Scroll Automatically to the Bottom of the Page

jQuery isn’t necessary. Most of the top results I got from a Google search gave me this answer: Where you have nested elements, the document might not scroll. In this case, you need to target the element that scrolls and use it’s scroll height instead. window.scrollTo(0,document.querySelector(“.scrollingContainer”).scrollHeight); You can tie that to the onclick event of … Read more