vanillajs
1 view | +0 today
Follow
Your new post is loading...
Your new post is loading...
Rescooped by Brian Tan from JavaScript for Line of Business Applications
Scoop.it!

Most Useful JavaScript Tips And Tricks For JavaScript developers

Most Useful JavaScript Tips And Tricks For JavaScript developers | vanillajs | Scoop.it

Here I collected some JavaScript Tips And Tricks and JavaScript Best Practices which can be used in our daily projects or bookmark it for reference purpose.

This includes some useful JavaScript snippets too.

* [] is better than “new Array();”
* Append an array to existing Array in JavaScript
* Check If An Object Is Array in JavaScript
* Truncate array in JavaScript
* JavaScript array to CSV
* Remove array element by Index or value in JavaScript
* Capture browser close Event
* Redirect webpage in JavaScript
* Declare Variables Outside of the For Statement
* Shorten the JavaScript Code snippets
* Conditional Operator in JavaScript
* Use OR (“||”) operator and AND(“&&”) operators in JavaScript


Via Jan Hesse
more...
No comment yet.
Rescooped by Brian Tan from JavaScript for Line of Business Applications
Scoop.it!

A Look Into How Parameters Are Passed In JavaScript

A Look Into How Parameters Are Passed In JavaScript | vanillajs | Scoop.it

I recently came across a question on StackOverflow about how JavaScript handles parameters, if they are passed by value or by reference. There seemed to be a lot of confusion and misinformation about what is actually happening behind the scenes.

TLDR; All arguments are passed by value in JavaScript, however, when dealing with non-primitive datatypes like objects and arrays a variable is created that points to the location of the object memory that is then is passed into the function. This means that changes to the variable inside the function will affect the original object's values. Once the argument is reassigned (e.g. arg = {} ) the variable now has the location of the new object in it so the original variable is no longer changed when the value changes.


Via Jan Hesse
more...
No comment yet.
Rescooped by Brian Tan from JavaScript for Line of Business Applications
Scoop.it!

Functional Refactoring in JavaScript

Functional Refactoring in JavaScript | vanillajs | Scoop.it

When discussing functional programming we often talk about the machinery, and not the core principles. Functional programming is not about monads, monoids, or zippers. It is primarily about writing programs by composing generic reusable functions. This article is about applying functional thinking when refactoring JavaScript code.


Via Jan Hesse
more...
No comment yet.