Похожие чаты

Hy gays how use a

& b outside of fetch api ?

5 ответов

11 просмотров
ali- Автор вопроса

‌‌‌‌‌‌‌‌‌‌‌‌fetch( url ) .then((response) => { if(response.ok){ return response.text(); } }) .then((text) => { var a = ( text.split(',')[18] ).split(';')[1] ; var b = ( text.split(',')[23] ) ; })‌‌‌‌‌‌‌‌‌‌‌‌

ali
‌‌‌‌‌‌‌‌‌‌‌‌fetch( url ) .then((response) => { ...

since you are using var, I think you can use it outside of the fetch. But before using them you should wait for the execution of the fetch. When fetch executed completely you can use them before exec it will give undefined most probably

ali- Автор вопроса
Not Available
since you are using var, I think you can use it ou...

no i can for example this has error ‌‌‌‌‌‌a is undefined ‌‌‌‌‌‌

ali- Автор вопроса
ali
no i can for example this has error ‌‌‌‌‌‌a is un...

‌‌‌‌‌‌ ‌‌‌‌‌‌fetch( url ) .then((response) => { if(response.ok){ return response.text(); } }) .then((text) => { var a = ( text.split(',')[18] ).split(';')[1] ; var b = ( text.split(',')[23] ) ; })‌‌‌‌‌‌‌‌ console.log(a) ‌‌‌‌‌‌

ali
‌‌‌‌‌‌ ‌‌‌‌‌‌fetch( url ) .then((response) => { ...

const run = async() => { const res = await fetch(url); const data = await response.text(); const a = ....; const b = ....; console.log(a, b) } run();

Похожие вопросы

Карта сайта