function radarconstructor(radar,j){
let r = radar
if(j==0){
r.center[0] = "10%"
}
if(j==1){
r.center[0] = "30%"
}
if(j==2){
r.center[0] = "50%"
}
return(r)
}
var radarradar = {
// shape: 'circle',
center:["10%","50%"],//put the radar chart in center
radius: "50%",
name: {
textStyle: {
color: '#fff',
backgroundColor: '#999',
borderRadius: 3,
padding: [3, 5]
}
},
axisLine: {
lineStyle: {
color: 'rgba(100, 100, 100, 0.15)'
}
},
splitLine: {
lineStyle: {
color: 'rgba(255, 255, 255, 0.1)'
}
},
indicator: [
{ name: 'Dimension1', max: 3},
{ name: 'Dimension2', max: 3},
{ name: 'Dimension3', max: 3},
{ name: 'Dimension4', max: 3},
{ name: 'Dimension5', max: 3},
]
}
radarconstructor(radarradar,1) console.log(radarradar.center) #this then shows ["30%", "50%"]
I checked that Js does not have pass by reference, so I was really confused. Thanks in advance if you answer this question!!!