我是一名初学者,正在学习JavaScript
我需要使用 babel 将我的ES6和Esnext代码转换为ES5。当我这样做时,最终代码在台式机浏览器上有效,而在移动浏览器上无效
我测试了很多方法,但结果却是相同的:第一个在线编译器,第二个通过npm,webpack,@ babel / core,@ babel / preset-env,babel-loader和babel-polyfill离线
使用babel之前的代码:
PickUpItems
后面的代码(通过在线网站):
alert('Hello');
let getData = async ()=>{
const response = await fetch('http://mywebsite/getData.php');
return await response.json();
};
getData().then((data)=>{
alert(data['properties'][0]['title']);
console.log(data['properties'][0]['title']);
});
alert('Goodbye');
离线代码太大,无法显示给您
你有什么主意吗?