반응형 배열2 includes() 메서드 (포함,특정요소포함) https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/Array/includes Array.prototype.includes() - JavaScript | MDN includes() 메서드는 배열이 특정 요소를 포함하고 있는지 판별합니다. developer.mozilla.org 특정 배열에 특정 요소가 포함하고 있는지 식별한다. const array1 = [1, 2, 3]; console.log(array1.includes(2)); // expected output: true const pets = ['cat', 'dog', 'bat']; console.log(pets.includes('cat')); // expecte.. 2022. 3. 29. axios 요청값 배열 저장(json), 리스트 전체출력(jsx,map반복문) 매우매우 고군분투했다. console을 수도없이 찍어볼만큼 휴...! 하지만 요약해서 기록해두자 아래코드는 useEffect로 불러온 axios코드 부분이다. let [array,setArray] = useState([]) ........ return ...... .then((result)=>{console.log('요청성공') console.log(result) setArray(result.data) ...... { array.length ===0 ?null :( array.map(function(a,index){ return ( // {index} {a.name} // 아니 배열+1개까지뜨다가지금은 왜 되냐..? ) }) ) } ........ - 여러가지 시도를 해봤다. 그렇게 해본결과 알게된 특이.. 2022. 3. 25. 이전 1 다음 반응형