words = ["Black", "AI/AN**", "NH/PI**", "White", "Asians"]
words.each do |word|
case word
when "Black"
word.gsub!("Black", "African American")
when "AI/AN**"
word.gsub!("AI/AN**", "American Indian or Alaskan Native")
when "NH/PI**"
word.gsub!("NH/P**", "ative Hawaiian or Other Pacific Islander")
end
end
AnswersList/AnswersList.js
неправилно импортирван реактimport React from 'react';
const arr = [4, 63, 3, 87];
console.log(arr.sort((a, b) => a - b));
arr.push(2);
console.log(arr.sort((a, b) => a - b));
const arr1 = [1, 2, 3];
const arr2 = [1, 2, 3];
const arr3 = [3, 2, 1];
if (JSON.stringify(arr1) == JSON.stringify(arr2) || JSON.stringify(arr1) == JSON.stringify(arr3)) {
alert('correct');
} else {
alert('not right');
}
function factorial(n) {
let f = 1;
for (let i = 2; i <= n; i++) {
f *= i;
}
return f;
}
const getRandomRiver = (n, arr) => arr.sort(() => 0.5 - Math.random()).slice(0, n);
const getRandomRiver = (n, arr) => {
return arr
.map(x => ({ x, r: Math.random() }))
.sort((a, b) => a.r - b.r)
.map(a => a.x)
.slice(0, n);
}
const [num, setNum] = useState(0);
const [text, setText] = useState('no');
const [textUpper, setТextUpper] = useState('HELLO');
const changeState = () => {
setNum(num + 1);
setText('yes');
setТextUpper('BYE');
}
const [data, setData] = useState({
num: 0,
text: 'no',
textUpper: 'HELLO'
});