Why is there no length property in this object?

problem description

related codes

<script>
    let arrayLike = {
        "0": "a",
        "1": "b",
        "2": "c",
        length: 3
    };

    var arr2 = Array.from(arrayLike); // ["a", "b", "c"]
    console.log(arrayLike)
    console.log(arr2)
</script>




<div id="liuyu"></div>
<script>
    $(document).ready(function(){
        $.ajax({
            method: "GET",
            url: "https://randomuser.me/api/ ",
            success:function( data ) {
                var nihao= data.results[0].id;
                console.log(nihao)
                console.log(Array.from(nihao))
             }  ,error:function(){
                return false;
            }
        })
    })
</script>



Nov.19,2021

you can take a look at this answer
Why does the object have no length attribute?

if you want to get the length attribute, you can add

to the prototype.
var a = {a:1,b:2,c:3,d:4};
 Object.prototype.length = function() {
 var count = 0;
    for(var i in this){
        if(this.hasOwnProperty(i)){//
            countPP;
        };
    };
    return count;   

 };
 alert(a.length());
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-1b3fda2-2c4f4.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-1b3fda2-2c4f4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?