500-keyboard-row-0824

몇월며칠·2022년 8월 24일

Leetcode

목록 보기
14/19
    if (wordsArr.every((r) => firstRow.includes(r))) {
      result.push(words[i]);
    } else if (wordsArr.every((r) => secondRow.includes(r))) {
      result.push(words[i]);
    } else if (wordsArr.every((r) => thirdRow.includes(r))) {
      result.push(words[i]);
    }

a배열 안에 b배열의 모든 요소들이 들어있는지 확인하는 방법

b.every((r) => a.includes(r))

처음 보는 .every 메소드

const isBelowThreshold = (currentValue) => currentValue < 40;

const array1 = [1, 30, 39, 29, 10, 13];

console.log(array1.every(isBelowThreshold));
// expected output: true

그렇다네요!

profile
What day is it today?

0개의 댓글