Found 6710 Articles for Javascript

Different techniques for copying objects in JavaScript

Abdul Rawoof
Updated on 02-Sep-2022 11:38:47

359 Views

In JavaScript, objects are the collection of a key value pairs. The properties of the object are the keys and is denoted with a string. The value of the key is the value of the property of the given object. Types/Techniques of object copying There are 2 types of copying objects in any language namely: deep copy, and shallow copy. Shallow Copy In this technique an object is copied as little as possible. For suppose if you copy a collection using this technique the structure of the collection is copied to the destination, not the elements. Example Following is an ... Read More

Advantages and Disadvantages of JavaScript

Abdul Rawoof
Updated on 12-Sep-2023 01:20:55

31K+ Views

JavaScript might be a client-side scripting language, inferring that the client's browser handles ASCII text file processing rather than an online server. With the aid of JavaScript, this can load the webpage without contacting the primary server. For instance, a JavaScript function might verify that all the required fields are filled out on an online form before it is submitted. The JavaScript code has the ability to output an error message before any data is actually sent to the server. Both advantages and disadvantages apply to JavaScript. A client's browser is frequently used to execute JavaScript directly. Similar advantages to ... Read More

What are the differences between lodash and underscore?

Ayush Gupta
Updated on 27-Nov-2019 10:03:22

1K+ Views

lodash and underscore are both utility libraries that make JavaScript easier by providing utils that make working with arrays, numbers, objects, strings, etc. much easier. These libraries are great for −Iterating arrays, objects, & stringsManipulating & testing valuesCreating composite functionsThey are both functional libraries. Lo-Dash is a fork of Underscore, and still follows Underscore’s API enough to allow it to serve as a drop-in replacement. But under the hood, it’s been completely rewritten, and it’s also added a number of features and functions that Underscore does not provide.Lo-Dash was created to provide more consistent cross-environment iteration support for arrays, strings, ... Read More

Difference between .extend() / .assign() and .merge() in Lodash library.

Abdul Rawoof
Updated on 02-Sep-2022 12:31:17

1K+ Views

The Lodash library is in JavaScript, which works on the top of ‘_.js’. It can be used while working with arrays, strings, objects, numbers, etc. The assign() method This function is used to copy the original object into a new object. The difference in this and the spread operator is when nested objects are present and if assign() is used to copy the object, then the nested object will not change and the other variables of the object can be changed. There are two parameters to the assign() function. The first parameter is curly braces {} which is used to ... Read More

What is an anonymous function in JavaScript?

Arnab Chakraborty
Updated on 23-Aug-2022 08:13:53

2K+ Views

Like other advanced languages, JavaScript also supports anonymous functions. From the word anonymous, it is clear that when a function has no identifier or no name, that function is called an anonymous function. The only difference between anonymous function and normal function is that normal function has names but anonymous functions do not have any Additionally, anonymous functions are used for simpler and shorter applications which are easier to maintain. In this article, we shall cover what is an anonymous function in JavaScript, how we can use them, their syntax and basic usage as well as advantages and limitations. ... Read More

What is Babel, and how will it help you write JavaScript?

Ayush Gupta
Updated on 27-Nov-2019 09:53:30

387 Views

Babel is a toolchain that is mainly used to convert ECMAScript 2015+ code into a backward-compatible version of JavaScript in current and older browsers or environments. Babel's plugins allow you to use the new syntax, right now without waiting for browser support.The main reasons to use babel JS are −Syntax transformation(Latest JS syntax to backward-compatible syntax.)Polyfill features that are missing in your target environment (through @babel/polyfill)Source code transformations (code modes)

Why do I need Babel JS?

Ayush Gupta
Updated on 27-Nov-2019 09:51:53

744 Views

Babel is a toolchain that is mainly used to convert ECMAScript 2015+ code into a backward-compatible version of JavaScript in current and older browsers or environments. Babel's plugins allow you to use the new syntax, right now without waiting for browser support.The main reasons to use babel JS are −Syntax transformation(Latest JS syntax to backward-compatible syntax.)Polyfill features that are missing in your target environment (through @babel/polyfill)Source code transformations (code modes)

Write the dependencies of backbone.js in javascript?

Ayush Gupta
Updated on 27-Nov-2019 09:50:24

224 Views

The only hard dependency(without which backbone js won't work at all) is Underscore.js. Underscore is a JavaScript library that provides a whole mess of useful functional programming helpers without extending any built-in objects.There are other dependencies required as you proceed to use more advanced features of backbone.js. For example,Libraries for RESTful persistence(Backbone.sync)History support via Backbone.RouterDOM manipulation with Backbone.View or Jquery

What is the architecture of backbone.js in javascript?

Ayush Gupta
Updated on 27-Nov-2019 09:48:50

187 Views

The BackboneJS gives a structure to the web applications that allows separating business logic and user interface logic.The architecture of BackboneJS contains the following modules -HTTP RequestThe HTTP client sends an HTTP request to a server in the form of a request message where web browsers, search engines, etc., acts like HTTP clients. The user requests for a file such as documents, images, etc., using the HTTP request protocol.RouterIt is used for routing the client-side applications and connects them to actions and events using URLs. It is a URL representation of the application's objects. This URL is changed manually by ... Read More

What is the use of backbone.js in structuring javascript?

Ayush Gupta
Updated on 27-Nov-2019 09:46:41

112 Views

Backbone is an MVC framework for the frontend. With Backbone, you represent data as Models, which can be created, validated, destroyed, and saved to the server. Whenever a UI action causes an attribute of a model to change, the model triggers a "change" event; all the Views that display the model's state can be notified of the change so that they are able to respond accordingly, re-rendering themselves with the new information.Backbone gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions views with declarative event handling, and ... Read More

Advertisements