Js function problem

 var ary=[1,2,3,4];
    function fn(ary){
        ary[0]=0;
        ary=[0];
        ary[0]=100;
        return ary;
    }
    var res=fn(ary);//res
    console.log(ary);
    console.log(res);
Mar.14,2021

var ary=[1,2,3,4];
    function fn(ary){
        ary[0]=0;//
        ary=[0];//
        ary[0]=100;//
        return ary;
    }
    var res=fn(ary);//res
    console.log(ary);//
    console.log(res);

The

function is also an object, which is a reference data type, and when assigned, it passes a reference value, which is equivalent to an address.

 var res=fn;//res 
  
  // 
  var res = fn(ary)//  fn(ary)  res
  // res  return  ary
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3bf05-2c2de.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3bf05-2c2de.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?