我可以只检查第一个元素吗

Can I check the first element only

目前,代码检查所有元素是否为 = a。如何只检查第一个元素或只检查第三个元素?

    let dogName = ['a', 'b', 'c'];
    
    for (i=0; i<dogName.length;i++){
        if(dogName[i] === 'a'){
            console.log('true');
    } else {
        console.log('false');
    }
}

table索引从0开始,你可以在这里看到关于table在JS中的所有信息:https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Global_Objects/Array

    let dogName = ['a', 'b', 'c'];
    if(dogName[0] ==='a')//the first
    {


    }
    if(dogName[2]==='a')//the third
    {

    }