Original object referenced as I apply .map function in JavaScript











up vote
0
down vote

favorite












I am reading data from a json file and storing it in an object in javascript , I am using d3js library to read the file.



This is what the raw data looks like in data.json file :



{
"bitcoin": [
{
"24h_vol": null,
"date": "12/5/2013",
"market_cap": null,
"price_usd": null
},
{
"24h_vol": null,
"date": "13/5/2013",
"market_cap": null,
"price_usd": null
},
{
"24h_vol": "0",
"date": "14/5/2013",
"market_cap": "1500517590",
"price_usd": "135.3"
},...]
"bitcoin_cash": [
{
"24h_vol": null,
"date": "12/5/2013",
"market_cap": null,
"price_usd": null
},
{
"24h_vol": null,
"date": "13/5/2013",
"market_cap": null,
"price_usd": null
},...]
}


I read this and then filter some of the null entries out and also parse the date and Integer values respectively, This is the code for the same:



//Get data
d3.json("data/coins.json").then((data) => {

console.log("original data", data.bitcoin);
/*---
original data (1633) [{…}, , …]

[0 … 99]

0: {24h_vol: null, date: "12/5/2013", market_cap: null, price_usd: null}
1: {24h_vol: null, date: "13/5/2013", market_cap: null, price_usd: null}
2: {24h_vol: "0", date: Tue May 14 2013 00:00:00 GMT-0400 (Eastern Daylight Time), market_cap: 1500517590, price_usd: 135.3}
...
--------*/


//Selector listener
$("#coin-select").change(function() {
var coinType =this.value;
var coinData = data[coinType];
var cleanData = coinData.filter((d) => {
return (d.price_usd)
}).map((d) => {
d.price_usd =+ d.price_usd;
d.market_cap =+ d.market_cap;
d.date = parsedDate(d.date);
return d;
});
console.log("cleanData", cleanData)

/*------
cleanData (1631) [{…}, {…}, , …]
[0 … 99]
0: {24h_vol: "0", date: Tue May 14 2013 00:00:00 GMT-0400 (Eastern Daylight Time), market_cap: 1500517590, price_usd: 135.3}
1: {24h_vol: "0", date: Wed May 15 2013 00:00:00 GMT-0400 (Eastern Daylight Time), market_cap: 1575032004, price_usd: 141.96}

---*/
update(cleanData);
});

//Default to bitcoin
$('#coin-select')
.val('bitcoin')
.trigger('change');

});


As you can see the console output , the original data has parsed values for date,market_cap and price_usd too, not sure why this is happening.



Thanks for you time.



PS: this doesn't only happens in chrome as suggested in the question : Is Chrome's JavaScript console lazy about evaluating arrays?










share|improve this question
























  • Objects are passed around by Ref, not Val. If you want to preserve the original, you'll need to perform your operation in a way which creates a new object, e.g. you could spread the object .map(d => ({...d, price_usd: d.price_usd + d.price_usd, market_cap: d.market_cap + d.market_cap, date: parsedDate(d.date)}))
    – Paul S.
    Nov 9 at 21:59








  • 1




    In your map, create a new object rather than modifying and returning the current one.
    – Kevin B
    Nov 9 at 22:09










  • Possible duplicate of Is Chrome's JavaScript console lazy about evaluating arrays?
    – vnt
    Nov 9 at 22:18










  • @vnt It doesn't seem like as it happens on other browsers too
    – Snedden27
    Nov 11 at 15:55










  • @KevinB that seem to work , but I still don't understand it completely , doens't have this line in the code: var coinData = data[coinType]; segregate the 'data' object from the 'coinData' object. don't seem to understand why using 'coinData' in map function object changes the original data object
    – Snedden27
    Nov 11 at 16:25















up vote
0
down vote

favorite












I am reading data from a json file and storing it in an object in javascript , I am using d3js library to read the file.



This is what the raw data looks like in data.json file :



{
"bitcoin": [
{
"24h_vol": null,
"date": "12/5/2013",
"market_cap": null,
"price_usd": null
},
{
"24h_vol": null,
"date": "13/5/2013",
"market_cap": null,
"price_usd": null
},
{
"24h_vol": "0",
"date": "14/5/2013",
"market_cap": "1500517590",
"price_usd": "135.3"
},...]
"bitcoin_cash": [
{
"24h_vol": null,
"date": "12/5/2013",
"market_cap": null,
"price_usd": null
},
{
"24h_vol": null,
"date": "13/5/2013",
"market_cap": null,
"price_usd": null
},...]
}


I read this and then filter some of the null entries out and also parse the date and Integer values respectively, This is the code for the same:



//Get data
d3.json("data/coins.json").then((data) => {

console.log("original data", data.bitcoin);
/*---
original data (1633) [{…}, , …]

[0 … 99]

0: {24h_vol: null, date: "12/5/2013", market_cap: null, price_usd: null}
1: {24h_vol: null, date: "13/5/2013", market_cap: null, price_usd: null}
2: {24h_vol: "0", date: Tue May 14 2013 00:00:00 GMT-0400 (Eastern Daylight Time), market_cap: 1500517590, price_usd: 135.3}
...
--------*/


//Selector listener
$("#coin-select").change(function() {
var coinType =this.value;
var coinData = data[coinType];
var cleanData = coinData.filter((d) => {
return (d.price_usd)
}).map((d) => {
d.price_usd =+ d.price_usd;
d.market_cap =+ d.market_cap;
d.date = parsedDate(d.date);
return d;
});
console.log("cleanData", cleanData)

/*------
cleanData (1631) [{…}, {…}, , …]
[0 … 99]
0: {24h_vol: "0", date: Tue May 14 2013 00:00:00 GMT-0400 (Eastern Daylight Time), market_cap: 1500517590, price_usd: 135.3}
1: {24h_vol: "0", date: Wed May 15 2013 00:00:00 GMT-0400 (Eastern Daylight Time), market_cap: 1575032004, price_usd: 141.96}

---*/
update(cleanData);
});

//Default to bitcoin
$('#coin-select')
.val('bitcoin')
.trigger('change');

});


As you can see the console output , the original data has parsed values for date,market_cap and price_usd too, not sure why this is happening.



Thanks for you time.



PS: this doesn't only happens in chrome as suggested in the question : Is Chrome's JavaScript console lazy about evaluating arrays?










share|improve this question
























  • Objects are passed around by Ref, not Val. If you want to preserve the original, you'll need to perform your operation in a way which creates a new object, e.g. you could spread the object .map(d => ({...d, price_usd: d.price_usd + d.price_usd, market_cap: d.market_cap + d.market_cap, date: parsedDate(d.date)}))
    – Paul S.
    Nov 9 at 21:59








  • 1




    In your map, create a new object rather than modifying and returning the current one.
    – Kevin B
    Nov 9 at 22:09










  • Possible duplicate of Is Chrome's JavaScript console lazy about evaluating arrays?
    – vnt
    Nov 9 at 22:18










  • @vnt It doesn't seem like as it happens on other browsers too
    – Snedden27
    Nov 11 at 15:55










  • @KevinB that seem to work , but I still don't understand it completely , doens't have this line in the code: var coinData = data[coinType]; segregate the 'data' object from the 'coinData' object. don't seem to understand why using 'coinData' in map function object changes the original data object
    – Snedden27
    Nov 11 at 16:25













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I am reading data from a json file and storing it in an object in javascript , I am using d3js library to read the file.



This is what the raw data looks like in data.json file :



{
"bitcoin": [
{
"24h_vol": null,
"date": "12/5/2013",
"market_cap": null,
"price_usd": null
},
{
"24h_vol": null,
"date": "13/5/2013",
"market_cap": null,
"price_usd": null
},
{
"24h_vol": "0",
"date": "14/5/2013",
"market_cap": "1500517590",
"price_usd": "135.3"
},...]
"bitcoin_cash": [
{
"24h_vol": null,
"date": "12/5/2013",
"market_cap": null,
"price_usd": null
},
{
"24h_vol": null,
"date": "13/5/2013",
"market_cap": null,
"price_usd": null
},...]
}


I read this and then filter some of the null entries out and also parse the date and Integer values respectively, This is the code for the same:



//Get data
d3.json("data/coins.json").then((data) => {

console.log("original data", data.bitcoin);
/*---
original data (1633) [{…}, , …]

[0 … 99]

0: {24h_vol: null, date: "12/5/2013", market_cap: null, price_usd: null}
1: {24h_vol: null, date: "13/5/2013", market_cap: null, price_usd: null}
2: {24h_vol: "0", date: Tue May 14 2013 00:00:00 GMT-0400 (Eastern Daylight Time), market_cap: 1500517590, price_usd: 135.3}
...
--------*/


//Selector listener
$("#coin-select").change(function() {
var coinType =this.value;
var coinData = data[coinType];
var cleanData = coinData.filter((d) => {
return (d.price_usd)
}).map((d) => {
d.price_usd =+ d.price_usd;
d.market_cap =+ d.market_cap;
d.date = parsedDate(d.date);
return d;
});
console.log("cleanData", cleanData)

/*------
cleanData (1631) [{…}, {…}, , …]
[0 … 99]
0: {24h_vol: "0", date: Tue May 14 2013 00:00:00 GMT-0400 (Eastern Daylight Time), market_cap: 1500517590, price_usd: 135.3}
1: {24h_vol: "0", date: Wed May 15 2013 00:00:00 GMT-0400 (Eastern Daylight Time), market_cap: 1575032004, price_usd: 141.96}

---*/
update(cleanData);
});

//Default to bitcoin
$('#coin-select')
.val('bitcoin')
.trigger('change');

});


As you can see the console output , the original data has parsed values for date,market_cap and price_usd too, not sure why this is happening.



Thanks for you time.



PS: this doesn't only happens in chrome as suggested in the question : Is Chrome's JavaScript console lazy about evaluating arrays?










share|improve this question















I am reading data from a json file and storing it in an object in javascript , I am using d3js library to read the file.



This is what the raw data looks like in data.json file :



{
"bitcoin": [
{
"24h_vol": null,
"date": "12/5/2013",
"market_cap": null,
"price_usd": null
},
{
"24h_vol": null,
"date": "13/5/2013",
"market_cap": null,
"price_usd": null
},
{
"24h_vol": "0",
"date": "14/5/2013",
"market_cap": "1500517590",
"price_usd": "135.3"
},...]
"bitcoin_cash": [
{
"24h_vol": null,
"date": "12/5/2013",
"market_cap": null,
"price_usd": null
},
{
"24h_vol": null,
"date": "13/5/2013",
"market_cap": null,
"price_usd": null
},...]
}


I read this and then filter some of the null entries out and also parse the date and Integer values respectively, This is the code for the same:



//Get data
d3.json("data/coins.json").then((data) => {

console.log("original data", data.bitcoin);
/*---
original data (1633) [{…}, , …]

[0 … 99]

0: {24h_vol: null, date: "12/5/2013", market_cap: null, price_usd: null}
1: {24h_vol: null, date: "13/5/2013", market_cap: null, price_usd: null}
2: {24h_vol: "0", date: Tue May 14 2013 00:00:00 GMT-0400 (Eastern Daylight Time), market_cap: 1500517590, price_usd: 135.3}
...
--------*/


//Selector listener
$("#coin-select").change(function() {
var coinType =this.value;
var coinData = data[coinType];
var cleanData = coinData.filter((d) => {
return (d.price_usd)
}).map((d) => {
d.price_usd =+ d.price_usd;
d.market_cap =+ d.market_cap;
d.date = parsedDate(d.date);
return d;
});
console.log("cleanData", cleanData)

/*------
cleanData (1631) [{…}, {…}, , …]
[0 … 99]
0: {24h_vol: "0", date: Tue May 14 2013 00:00:00 GMT-0400 (Eastern Daylight Time), market_cap: 1500517590, price_usd: 135.3}
1: {24h_vol: "0", date: Wed May 15 2013 00:00:00 GMT-0400 (Eastern Daylight Time), market_cap: 1575032004, price_usd: 141.96}

---*/
update(cleanData);
});

//Default to bitcoin
$('#coin-select')
.val('bitcoin')
.trigger('change');

});


As you can see the console output , the original data has parsed values for date,market_cap and price_usd too, not sure why this is happening.



Thanks for you time.



PS: this doesn't only happens in chrome as suggested in the question : Is Chrome's JavaScript console lazy about evaluating arrays?







javascript ecmascript-6






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 11 at 15:57

























asked Nov 9 at 21:52









Snedden27

87942045




87942045












  • Objects are passed around by Ref, not Val. If you want to preserve the original, you'll need to perform your operation in a way which creates a new object, e.g. you could spread the object .map(d => ({...d, price_usd: d.price_usd + d.price_usd, market_cap: d.market_cap + d.market_cap, date: parsedDate(d.date)}))
    – Paul S.
    Nov 9 at 21:59








  • 1




    In your map, create a new object rather than modifying and returning the current one.
    – Kevin B
    Nov 9 at 22:09










  • Possible duplicate of Is Chrome's JavaScript console lazy about evaluating arrays?
    – vnt
    Nov 9 at 22:18










  • @vnt It doesn't seem like as it happens on other browsers too
    – Snedden27
    Nov 11 at 15:55










  • @KevinB that seem to work , but I still don't understand it completely , doens't have this line in the code: var coinData = data[coinType]; segregate the 'data' object from the 'coinData' object. don't seem to understand why using 'coinData' in map function object changes the original data object
    – Snedden27
    Nov 11 at 16:25


















  • Objects are passed around by Ref, not Val. If you want to preserve the original, you'll need to perform your operation in a way which creates a new object, e.g. you could spread the object .map(d => ({...d, price_usd: d.price_usd + d.price_usd, market_cap: d.market_cap + d.market_cap, date: parsedDate(d.date)}))
    – Paul S.
    Nov 9 at 21:59








  • 1




    In your map, create a new object rather than modifying and returning the current one.
    – Kevin B
    Nov 9 at 22:09










  • Possible duplicate of Is Chrome's JavaScript console lazy about evaluating arrays?
    – vnt
    Nov 9 at 22:18










  • @vnt It doesn't seem like as it happens on other browsers too
    – Snedden27
    Nov 11 at 15:55










  • @KevinB that seem to work , but I still don't understand it completely , doens't have this line in the code: var coinData = data[coinType]; segregate the 'data' object from the 'coinData' object. don't seem to understand why using 'coinData' in map function object changes the original data object
    – Snedden27
    Nov 11 at 16:25
















Objects are passed around by Ref, not Val. If you want to preserve the original, you'll need to perform your operation in a way which creates a new object, e.g. you could spread the object .map(d => ({...d, price_usd: d.price_usd + d.price_usd, market_cap: d.market_cap + d.market_cap, date: parsedDate(d.date)}))
– Paul S.
Nov 9 at 21:59






Objects are passed around by Ref, not Val. If you want to preserve the original, you'll need to perform your operation in a way which creates a new object, e.g. you could spread the object .map(d => ({...d, price_usd: d.price_usd + d.price_usd, market_cap: d.market_cap + d.market_cap, date: parsedDate(d.date)}))
– Paul S.
Nov 9 at 21:59






1




1




In your map, create a new object rather than modifying and returning the current one.
– Kevin B
Nov 9 at 22:09




In your map, create a new object rather than modifying and returning the current one.
– Kevin B
Nov 9 at 22:09












Possible duplicate of Is Chrome's JavaScript console lazy about evaluating arrays?
– vnt
Nov 9 at 22:18




Possible duplicate of Is Chrome's JavaScript console lazy about evaluating arrays?
– vnt
Nov 9 at 22:18












@vnt It doesn't seem like as it happens on other browsers too
– Snedden27
Nov 11 at 15:55




@vnt It doesn't seem like as it happens on other browsers too
– Snedden27
Nov 11 at 15:55












@KevinB that seem to work , but I still don't understand it completely , doens't have this line in the code: var coinData = data[coinType]; segregate the 'data' object from the 'coinData' object. don't seem to understand why using 'coinData' in map function object changes the original data object
– Snedden27
Nov 11 at 16:25




@KevinB that seem to work , but I still don't understand it completely , doens't have this line in the code: var coinData = data[coinType]; segregate the 'data' object from the 'coinData' object. don't seem to understand why using 'coinData' in map function object changes the original data object
– Snedden27
Nov 11 at 16:25












1 Answer
1






active

oldest

votes

















up vote
1
down vote



accepted










Try something like this:



$("#coin-select").change(function() {
var coinType = this.value;
var coinData = data[coinType];
var cleanData = coinData.filter(x => x.price_usd)
.map(d => ({
price_usd: d.price_usd =+ d.price_usd,
market_cap: d.market_cap =+ d.market_cap,
date: parsedDate(d.date)
}));
update(cleanData);
});


This makes sure you return a new object from your map so you do not mutate the original and also cleans up some of the explicit returns you had which are not needed.






share|improve this answer























  • Not sure how you are using the arrow function for .map. copied letter by letter seems to give a syntax error
    – Snedden27
    Nov 11 at 16:18










  • There was an extra comma in the object literal. Try again
    – Akrion
    Nov 11 at 18:03










  • yes it does but there seems to be a missing ending parenthesis too , can you change that and also if possible can you make the new object creation more explicit May its just my opinion but it might a little more discern-able for ecmascript6 noobs like me
    – Snedden27
    Nov 12 at 0:55












  • Updated it. Sorry on mobile ...
    – Akrion
    Nov 12 at 0:58













Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53233694%2foriginal-object-referenced-as-i-apply-map-function-in-javascript%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
1
down vote



accepted










Try something like this:



$("#coin-select").change(function() {
var coinType = this.value;
var coinData = data[coinType];
var cleanData = coinData.filter(x => x.price_usd)
.map(d => ({
price_usd: d.price_usd =+ d.price_usd,
market_cap: d.market_cap =+ d.market_cap,
date: parsedDate(d.date)
}));
update(cleanData);
});


This makes sure you return a new object from your map so you do not mutate the original and also cleans up some of the explicit returns you had which are not needed.






share|improve this answer























  • Not sure how you are using the arrow function for .map. copied letter by letter seems to give a syntax error
    – Snedden27
    Nov 11 at 16:18










  • There was an extra comma in the object literal. Try again
    – Akrion
    Nov 11 at 18:03










  • yes it does but there seems to be a missing ending parenthesis too , can you change that and also if possible can you make the new object creation more explicit May its just my opinion but it might a little more discern-able for ecmascript6 noobs like me
    – Snedden27
    Nov 12 at 0:55












  • Updated it. Sorry on mobile ...
    – Akrion
    Nov 12 at 0:58

















up vote
1
down vote



accepted










Try something like this:



$("#coin-select").change(function() {
var coinType = this.value;
var coinData = data[coinType];
var cleanData = coinData.filter(x => x.price_usd)
.map(d => ({
price_usd: d.price_usd =+ d.price_usd,
market_cap: d.market_cap =+ d.market_cap,
date: parsedDate(d.date)
}));
update(cleanData);
});


This makes sure you return a new object from your map so you do not mutate the original and also cleans up some of the explicit returns you had which are not needed.






share|improve this answer























  • Not sure how you are using the arrow function for .map. copied letter by letter seems to give a syntax error
    – Snedden27
    Nov 11 at 16:18










  • There was an extra comma in the object literal. Try again
    – Akrion
    Nov 11 at 18:03










  • yes it does but there seems to be a missing ending parenthesis too , can you change that and also if possible can you make the new object creation more explicit May its just my opinion but it might a little more discern-able for ecmascript6 noobs like me
    – Snedden27
    Nov 12 at 0:55












  • Updated it. Sorry on mobile ...
    – Akrion
    Nov 12 at 0:58















up vote
1
down vote



accepted







up vote
1
down vote



accepted






Try something like this:



$("#coin-select").change(function() {
var coinType = this.value;
var coinData = data[coinType];
var cleanData = coinData.filter(x => x.price_usd)
.map(d => ({
price_usd: d.price_usd =+ d.price_usd,
market_cap: d.market_cap =+ d.market_cap,
date: parsedDate(d.date)
}));
update(cleanData);
});


This makes sure you return a new object from your map so you do not mutate the original and also cleans up some of the explicit returns you had which are not needed.






share|improve this answer














Try something like this:



$("#coin-select").change(function() {
var coinType = this.value;
var coinData = data[coinType];
var cleanData = coinData.filter(x => x.price_usd)
.map(d => ({
price_usd: d.price_usd =+ d.price_usd,
market_cap: d.market_cap =+ d.market_cap,
date: parsedDate(d.date)
}));
update(cleanData);
});


This makes sure you return a new object from your map so you do not mutate the original and also cleans up some of the explicit returns you had which are not needed.







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 12 at 0:57

























answered Nov 9 at 22:16









Akrion

8,79411223




8,79411223












  • Not sure how you are using the arrow function for .map. copied letter by letter seems to give a syntax error
    – Snedden27
    Nov 11 at 16:18










  • There was an extra comma in the object literal. Try again
    – Akrion
    Nov 11 at 18:03










  • yes it does but there seems to be a missing ending parenthesis too , can you change that and also if possible can you make the new object creation more explicit May its just my opinion but it might a little more discern-able for ecmascript6 noobs like me
    – Snedden27
    Nov 12 at 0:55












  • Updated it. Sorry on mobile ...
    – Akrion
    Nov 12 at 0:58




















  • Not sure how you are using the arrow function for .map. copied letter by letter seems to give a syntax error
    – Snedden27
    Nov 11 at 16:18










  • There was an extra comma in the object literal. Try again
    – Akrion
    Nov 11 at 18:03










  • yes it does but there seems to be a missing ending parenthesis too , can you change that and also if possible can you make the new object creation more explicit May its just my opinion but it might a little more discern-able for ecmascript6 noobs like me
    – Snedden27
    Nov 12 at 0:55












  • Updated it. Sorry on mobile ...
    – Akrion
    Nov 12 at 0:58


















Not sure how you are using the arrow function for .map. copied letter by letter seems to give a syntax error
– Snedden27
Nov 11 at 16:18




Not sure how you are using the arrow function for .map. copied letter by letter seems to give a syntax error
– Snedden27
Nov 11 at 16:18












There was an extra comma in the object literal. Try again
– Akrion
Nov 11 at 18:03




There was an extra comma in the object literal. Try again
– Akrion
Nov 11 at 18:03












yes it does but there seems to be a missing ending parenthesis too , can you change that and also if possible can you make the new object creation more explicit May its just my opinion but it might a little more discern-able for ecmascript6 noobs like me
– Snedden27
Nov 12 at 0:55






yes it does but there seems to be a missing ending parenthesis too , can you change that and also if possible can you make the new object creation more explicit May its just my opinion but it might a little more discern-able for ecmascript6 noobs like me
– Snedden27
Nov 12 at 0:55














Updated it. Sorry on mobile ...
– Akrion
Nov 12 at 0:58






Updated it. Sorry on mobile ...
– Akrion
Nov 12 at 0:58




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53233694%2foriginal-object-referenced-as-i-apply-map-function-in-javascript%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown