let str4 = 'a_baba_galamaga_tvoe_korito_est_nesti';
let a4_from = 'k';
let a4_to = 't';
const f4 = (str, a, b) => {
let strNew = str4.split('_');
let res = strNew.find((word,index,arr) => {
if (
word.indexOf(a) !== -1 &&
word.indexOf(b) !== -1 &&
word.indexOf(b) - word.indexOf(a) > 0
){
return true;
}
});
document.querySelector('.out-4').innerHTML = (res !== undefined)
? res.slice(res.indexOf(a) + 1, res.indexOf(b))
: `undefined`;
}
f4(str4, a4_from, a4_to);
class MyClass extends React.Component {
constructor(props) {
super(props);
this.state = {
current: 'one'
};
}
render() {
return (
<section className="section">
<Tab value="one" active={this.state.current === 'one'} onClick={() => this.setState({current: 'one'})}>One</Tab>
<Tab value="two" active={this.state.current === 'two'} onClick={() => this.setState({current: 'two'})}>Two</Tab>
</section>
)
}
}