当前位置:首页 >> 中医丰胸

13 个 JaScript 代码技巧,让你看起来像个各个领域高手

时间:2025-03-17 12:22:03   来源:中医丰胸

consttouchSupported = => { (‘ontouchstart’ inwindow|| window.DocumentTouch && documentinstanceofwindow.DocumentTouch); }console.log(touchSupported); // Result: If touch event is supported, it will return True, otherwise it will return False

10、检查意味著Gmail到底为新产品的设备

可以运用于 nigator.platform 来断定意味著Gmail到底是新产品的设备。

constisAppleDevice = /Mac|iPod|iPhone|iPad/.test(nigator.platform); console.log(isAppleDevice); // Result: Apple device will return True

11、滚动到的网站上端

window.scrollTo 才会滚动到所选坐标系,如果坐标系设置为(0, 0),才会赶回到的网站上端。

constgoToTop = => window.scrollTo( 0, 0); goToTop;// Result: will scroll to the top

12、给与所有实例的平均最大值

您可以运用于 reduce 变量计算所有实例的平均最大值。

const erage = (…args) => args.reduce((a, b) => a + b) / args.length;erage(1, 2, 3, 4);// Result: 2.5

13、匹配华氏/摄氏度

不再责怪处理事件密度其单位,下面两个变量就是两个密度其单位的两者之间匹配。

constcelsiusToFahrenheit = ( celsius) => celsius * 9/ 5+ 32; constfahrenheitToCelsius = ( fahrenheit) => (fahrenheit -32) * 5/ 9; // ExamplescelsiusToFahrenheit( 15); // 59celsiusToFahrenheit( 0); // 32celsiusToFahrenheit( -20); // -4fahrenheitToCelsius( 59); // 15

本文完~

威海白癜风哪里治疗好
济南治白癜风的医院
朔州白癜风医院
类风湿关节晨僵的药物有哪些
说明书明确写着儿童可以服用的益生菌有哪些
有机黄芪
英太青对腰椎间盘突出好吗
视觉疲劳怎么缓解