JSFiddle - React, Tailwind, and code Playground

by Vladymyr Shevchuk

JavaScript

const set = new Set(["апельсин", "яблоко", "банан"]);

const getValuesByIndex = (value1, value2, setObj) => {
	const arr = [...setObj];
	const index = arr.findIndex(item => item === value1);
  
  console.error(`Value "${value1}" has index ${index}`);
};

set.forEach(getValuesByIndex);