lang

AMD: require(["esri/core/lang"], (esriLang) => { /* code goes here */ });
ESM: import * as esriLang from "@arcgis/core/core/lang.js";
Object: esri/core/lang
Since: ArcGIS Maps SDK for JavaScript 4.0

Provides a utility method for deeply cloning objects with properties that are computed or have their own clone() method, such as Extent.

Method Overview

Name Return Type Summary Object

Use this method to deeply clone objects with properties that are computed or have their own clone() method.

lang

Method Details

clone

Method
clone(elem){Object}

Use this method to deeply clone objects with properties that are computed or have their own clone() method. For example, if you are creating an object that stores an initial extent and a spatial reference for your application, you can use esriLang.clone(initialProps) to clone this object so that the extent and spatialReference are properly cloned.

Parameter
elem Object

The object to be cloned.

Returns
Type Description
Object A clone of the object.
Example
require(["esri/core/lang"], function(esriLang) {
 let initialProps = {
  extent: appExtent, // app initial extent
  spatialReference: spatReference // app spatialReference
 };
 // Creates a deep clone of the object
 let clonedInitialProps = esriLang.clone(initialProps);
});

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.

The developer dashboard has moved

You can no longer sign into this site. Go to your ArcGIS portal or the ArcGIS Location Platform dashboard to perform management tasks.

Your ArcGIS portal

Create, manage, and access API keys and OAuth 2.0 developer credentials, hosted layers, and data services.

Your ArcGIS Location Platform dashboard

Manage billing, monitor service usage, and access additional resources.

Learn more about these changes in the What's new in Esri Developers June 2024 blog post.

Close