JavaScript
const hello = "Hello world. Good Bye world."; const key = "world"; const firstPos = hello.indexOf(key); // первое вхождение const lastPos = hello.lastIndexOf(key); // последнее вхождение console.log("First: ", firstPos); // 6 console.log("Last: ", lastPos); // 22 const includeWorld = hello.includes("world"); // содержит ли строка подстроку "world" console.log(includeWorld); // true const includeWork = hello.includes("work"); // содержит ли строка подстроку "work" console.log(includeWork); // false