数字化转型与当前GenAI领导者之间的关键区别在于,CEO和CFO(而非CIO)似乎参与了指导AI投资的过程。例如,Accenture在2024年1月报告称,到2023年底,在财报电话会议中提到AI的次数几乎达到4万次,因为C级领导层正在为“重大技术变革”做好准备。
根据Accenture的研究,CEO和CFO谈论AI和GenAI是有原因的。所有迹象都表明,AI正在重新定义我们所知的商业模式。如果我们从多年的数字化与数字化转型中学到什么,那就是仅靠数字化无法实现真正的转型。
鉴于GenAI的巨大潜力,不难理解几乎每位CEO都计划大力投资GenAI。根据BCG的数据,AI已经成为前三大技术优先事项之一,85%的顶级领导者打算从现在开始增加投资。
事实上,BCG发现,GenAI的兴趣和投资意向的规模在公司61年的历史中超过了所有其他技术进步,这使得GenAI可能比互联网、社交媒体和移动革命更具颠覆性。
后台低代码简化开发流程的利器:
获取浏览器 Cookie 的值
使用 document.cookie 来获取 Cookie 的值。
const cookie = name => ; document.cookie.split(;{name}=).pop().split(';').shift();
cookie('_ga');
// Result: "GA1.2.1929736587.1601974046"
将 RGB 转换为十六进制
const rgbToHex = (r, g, b) => "#" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
rgbToHex(0, 51, 255);
// Result: #0033ff`
复制到剪贴板
使用
navigator.clipboard.writeText 轻松将任何文本复制到剪贴板上。
const copyToClipboard = (text) => navigator.clipboard.writeText(text);
copyToClipboard("Hello World");
4.检查日期是否有效
使用以下代码段检查日期是否有效。
const isDateValid = (...val) => !Number.isNaN(new Date(...val).valueOf());
isDateValid("December 17, 1995 03:24:00");
// Result: true
5.找出一年中的某一天
查找日期中的某一天。
const dayOfYear = (date) => Math.floor((date - new Date(date.getFullYear(), 0, 0)) / 1000 / 60 / 60 / 24);
dayOfYear(new Date());
// Result: 272
将6.字符串首字母大写
Javascript 没有内置的大写函数,因此我们可以使用以下代码。
const capitalize = str => str.charAt(0).toUpperCase() + str.slice(1)
capitalize("follow for more")
// Result: Follow for more
7.计算两天之间相差的天数
使用以下代码段查找给定 2 天之间相差的天数。
const dayDif = (date1, date2) => Math.ceil(Math.abs(date1.getTime() - date2.getTime()) / 86400000)
dayDif(new Date("2020-10-21"), new Date("2021-10-22"))
// Result: 366
8.清除所有 Cookie
通过使用 document.cookie 可以轻松清除存储在网页中的所有 cookie 。
const clearCookies = document.cookie.split(';').forEach(cookie => document.cookie = cookie.replace(/^ +/, '').replace(/=.*/, =;expires=${new Date(0).toUTCString()};path=/));
生成随机十六进制
使用 Math.random 和 padEnd 属性生成随机的十六进制。
const randomHex = () => #${Math.floor(Math.random() * 0xffffff).toString(16).padEnd(6, "0")};
console.log(randomHex());
// Result: #92b008
数组去重
使用 SetJavaScript 可以轻松地删除重复项。超级有用!
const removeDuplicates = (arr) => [...new Set(arr)];
console.log(removeDuplicates([1, 2, 3, 3, 4, 4, 5, 5, 6]));
// Result: [ 1, 2, 3, 4, 5, 6 ]
从 URL 获取查询参数
通过 window.location 或原始 URL 轻松查询 goole.com?search=easy&page=3 的参数。
const getParameters = (URL) => {
URL = JSON.parse('{"' + decodeURI(URL.split("?")[1]).replace(/"/g, '\"').replace(/&/g, '","').replace(/=/g, '":"') +'"}');
return JSON.stringify(URL);
};
getParameters(window.location)
// Result: { search : "easy", page : 3 }
/---------------or-------------/
Object.fromEntries(new URLSearchParams(window.location.search))
从日期获取“时分秒”格式的时间
我们可以从日期中,获取到 hour : minutes : seconds 格式的时间:
const timeFromDate = date => date.toTimeString().slice(0, 8);
console.log(timeFromDate(new Date(2021, 0, 10, 17, 30, 0)));
// Result: "17:30:00"
确认奇偶数
const isEven = num => num % 2 === 0;
console.log(isEven(2));
// Result: True
/---------------------or----------------/
const isEven = num => (num & 1) === 0
console.log(isEven(2));
// Result: True
求平均值
使用 reduce 方法找到多个数字的平均值。
const average = (...args) => args.reduce((a, b) => a + b) / args.length;
average(1, 2, 3, 4);
// Result: 2.5
回到顶部
使用 window.scrollTo(0, 0) 方法自动回到顶部。将 x 和 y 都设置为 0。
const goToTop = () => window.scrollTo(0, 0);
goToTop();
翻转字符串
使用split,reverse 和 join 方法轻松翻转字符串。
const reverse = str => str.split('').reverse().join('');
reverse('hello world');
// Result: 'dlrow olleh'
检查数组是否为空
检查数组是否为空的简单代码,结果将返回 true 或 false。
const isNotEmpty = arr => Array.isArray(arr) && arr.length > 0;
isNotEmpty([1, 2, 3]);
参考-批量生成是随机的英文+中文如下数据:
// Result: true
arpent.92demo.com
arpnet.92demo.com
arquebusier.92demo.com
arranged.92demo.com
arrastra.92demo.com
arrenotokous.92demo.com
arrenotoky.92demo.com
arrestant.92demo.com
arrestee.92demo.com
arrestive.92demo.com
arret.92demo.com
arrhizal.92demo.com
arrhythmically.92demo.com
arriero.92demo.com
arrisways.92demo.comm
arrivederci.92demo.com
arrivisme.92demo.com
arroba.92demo.com
arrowheaded.92demo.com
arrowworm.92demo.com
arsenicate.92demo.com
arsenism.92demo.com
arseniureted.92demo.com
arsenous.92demo.com
arsonite.92demo.com
arsonous.92demo.com
arspoetica.92demo.com
artal.92demo.com
arteriogram.92demo.com
arteriosclerotic.92demo.com
arthral.92demo.com
arthralgic.92demo.com
arthrodial.92demo.com
arthrodic.92demo.com
arthromere.92demo.comm
arthromeric.92demo.com
arthroplastic.92demo.com
arthrosporic.92demo.com
arthrosporous.92demo.com
arthrotropic.92demo.com
articulacy.92demo.com
artie.92demo.com
artifacts.92demo.com
artifical.92demo.com
artiodactyl.92demo.com
artiodactylous.92demo.com
artisanate.92demo.com
artisanry.92demo.com
artisanship.92demo.com
artotype.92demo.com
artsy.92demo.com
aruba.92demo.com
arugula.92demo.com
aruspex.92demo.com
aruspicy.92demo.comm
arvo.92demo.com
aryballos.92demo.com
arytenoid.92demo.com
arytenoidal.92demo.com
arytenoidectomy.92demo.com
asa.92demo.com
asahigawa.92demo.com
asahikawa.92demo.com
asana.92demo.com
asansol.92demo.com
asarh.92demo.com
asarum.92demo.com
asbestoidal.92demo.com
asbestotic.92demo.com
asbestous.92demo.com
asc.92demo.com
ascanius.92demo.com
ascap.92demo.com
asce.92demo.com
ascendence.92demo.comm
ascender.92demo.com
ascensionist.92demo.com
ascesis.92demo.com
asciferous.92demo.com
ascigerous.92demo.com
asclepiad.92demo.com
asclepiadaceous.92demo.com
asclepiadean.92demo.com
asclepiadic.92demo.com
ascocarpous.92demo.com
ascogonial.92demo.com
ascolichen.92demo.com
ascomycetous.92demo.com
ascorbate.92demo.com
ascorbic.92demo.comm
ascosporic.92demo.com
ascosporous.92demo.com
ascu.92demo.com
ase.92demo.com
asean.92demo.com
aseasonal.92demo.com
aseity.92demo.com
asepticism.92demo.com
asepticize.92demo.com
asexualize.92demo.com
ashake.92demo.com
ashcake.92demo.com
ashet.92demo.com
ashikaga.92demo.com
ashimmer.92demo.com
ashine.92demo.com
ashiver.92demo.com
ashkhabad.92demo.comm
ashlared.92demo.com
ashram.92demo.com
ashtoreth.92demo.com
asiadollar.92demo.com
asianic.92demo.com
asid.92demo.com
asin.92demo.com
asio.92demo.com
askesis.92demo.com
asl.92demo.com
asla.92demo.com
aslef.92demo.com
asmara.92demo.com
asme.92demo.com
asne.92demo.com
aso.92demo.com
asomatous.92demo.com
asonant.92demo.comm
asonia.92demo.com
asosan.92demo.com
aspartokinase.92demo.com
aspca.92demo.com
aspectant.92demo.com
aspectual.92demo.com
asper.92demo.com
asperate.92demo.com
aspergill.92demo.com
asperifoliate.92demo.com
aspersory.92demo.com
aspi.92demo.com
aspiratory.92demo.com
aspirer.92demo.com
aspish.92demo.com
aspishly.92demo.com
asportation.92demo.com
asprawl.92demo.comm
aspuint.92demo.com
asroc.92demo.com
assab.92demo.com
assafetida.92demo.com
assailment.92demo.com
assaultive.92demo.com
assaultiveness.92demo.com
assemblagist.92demo.com
assemblywoman.92demo.com
assertative.92demo.com
asserted.92demo.com
assertedly.92demo.com
assertor.92demo.com
assertorily.92demo.com
assertory.92demo.com
asshead.92demo.com
assheaded.92demo.com
assheadedness.92demo.com
asshur.92demo.com
assibilate.92demo.comm
assibilation.92demo.com
assignments.92demo.com
assimilado.92demo.com
assistantship.92demo.com
assiut.92demo.com
associateship.92demo.com
assoluta.92demo.com
assonate.92demo.com
assortive.92demo.com
assouan.92demo.com
assr.92demo.com
assuan.92demo.com
assuetude.92demo.com
assur.92demo.com
assuror.92demo.com
astatically.92demo.com
astaticism.92demo.com
astatki.92demo.comm
asteraceous.92demo.com
asteriated.92demo.com
asterid.92demo.com
asteroidean.92demo.com
asthenope.92demo.com
asthenopic.92demo.com
asthmatoid.92demo.com
asthore.92demo.com
asti.92demo.com
astigmatometry.92demo.com
astigmometry.92demo.com
astilbe.92demo.com
astm.92demo.com
astolat.92demo.com
astoundment.92demo.com
astp.92demo.com
astragalar.92demo.com
astragalomancy.92demo.comm
astrand.92demo.com
astrid.92demo.com
astringer.92demo.com
astrobotany.92demo.com
astrodynamics.92demo.com
astrogator.92demo.com
astrograph.92demo.com
astrographic.92demo.com
astrolater.92demo.com
astrolatry.92demo.com
astrolithology.92demo.com
astrologian.92demo.com
astrologist.92demo.com
astrologous.92demo.com
astromancer.92demo.com
astromancy.92demo.com
astromantic.92demo.com
astronautess.92demo.comm
astronautic.92demo.com
astronautically.92demo.com
astronome.92demo.com
astrophotometry.92demo.com
astropologist.92demo.com
astucious.92demo.com
asturian.92demo.com
asturias.92demo.com
astyanax.92demo.com
asu.92demo.com
aswarm.92demo.com
asway.92demo.com
aswirl.92demo.com
aswoon.92demo.com
asyllabic.92demo.com
asymptomatic.92demo.com
asymptomatically.92demo.com
asymptotical.92demo.comm
asynergy.92demo.com
asyntactic.92demo.com
atabal.92demo.com
atacama.92demo.com
atactic.92demo.com
ataghan.92demo.com
ataman.92demo.com
atamasco.92demo.com
atapi.92demo.com
ataunt.92demo.com
atavist.92demo.com
atd.92demo.com
atechnic.92demo.com
atelectatic.92demo.com
atelic.92demo.com
atemporal.92demo.com
aten.92demo.com
atenism.92demo.comm
atergo.92demo.com
aterian.92demo.com
athabascan.92demo.com
athambia.92demo.com
athematic.92demo.com
athenai.92demo.com
atheoretical.92demo.com
atherogenesis.92demo.com
atherogenic.92demo.com
atherosclerotic.92demo.com
atherosis.92demo.com
athetoid.92demo.com
athonite.92demo.com
athrill.92demo.com
athrob.92demo.com
athrocytosis.92demo.com
athwarthawse.92demo.com
athymic.92demo.comm
atishoo.92demo.com
atkins.92demo.com
atlanticist.92demo.com
atlantosaurus.92demo.com
atlatl.92demo.com
atli.92demo.com
atmological.92demo.com
atmologist.92demo.com
atmolyze.92demo.com
atmolyzer.92demo.com
atmometric.92demo.com
ato.92demo.com
atomarium.92demo.com
atomise.92demo.com
atomiser.92demo.com
atomistics.92demo.com
atomix.92demo.com
atomry.92demo.comm
aton.92demo.com
atonalism.92demo.com
atonalistic.92demo.com
atoneable.92demo.com
atonism.92demo.com
atopic.92demo.com
atoxic.92demo.com
atrabiliar.92demo.com
atrament.92demo.com
atramentous.92demo.com
atrato.92demo.com
atraumatic.92demo.com
atraumatically.92demo.com
atremble.92demo.com
atresic.92demo.com
atretic.92demo.com
atreus.92demo.com
atrioventricular.92demo.comm
atroceruleous.92demo.com
atrophied.92demo.com
atropos.92demo.com
atrous.92demo.com
att.92demo.com
attabal.92demo.com
attacca.92demo.com
attackman.92demo.com
attaintment.92demo.com
attainture.92demo.com
attap.92demo.com
attemperator.92demo.com
attending.92demo.com
attentat.92demo.com
attenuable.92demo.com
attestant.92demo.com
attestative.92demo.com
attestator.92demo.com
attirement.92demo.com
attitudinarian.92demo.comm
attractability.92demo.com
attractableness.92demo.com
attractile.92demo.com
attrahent.92demo.com
attrit.92demo.com
attrited.92demo.com
attu.92demo.com
attunement.92demo.com
atwain.92demo.com
atween.92demo.com
atwirl.92demo.com
atwitch.92demo.com
atwitter.92demo.com
aubergiste.92demo.com
aubrey.92demo.com
aubrietia.92demo.com
auc.92demo.com
aucuba.92demo.com
audient.92demo.com
auding.92demo.comm
audiocassette.92demo.com
audiodontics.92demo.com
audiogenic.92demo.com
audiolingual.92demo.com
audiometric.92demo.com
audiometrically.92demo.com
audiometrist.92demo.com
audion.92demo.com
audiotactile.92demo.com
audiotape.92demo.com
auditress.92demo.com
auew.92demo.com
augsburg.92demo.com
augusta.92demo.com
auguste.92demo.com
augustinianism.92demo.com
aujus.92demo.com
aulic.92demo.comm
auralize.92demo.com
auramine.92demo.com
aurantiaceous.92demo.com
aurar.92demo.com
aureus.92demo.com
auriculate.92demo.com
auriculoventricular.92demo.com
aurific.92demo.com
aurification.92demo.com
aurify.92demo.com
auris.92demo.com
auriscopic.92demo.com
auriscopically.92demo.com
auriscopy.92demo.com
aurorean.92demo.com
aus.92demo.comm
auscultative.92demo.com
auscultator.92demo.com
ausform.92demo.com
auspex.92demo.com
auspices.92demo.com
auspicial.92demo.com
austenian.92demo.com
australioid.92demo.com
australoid.92demo.com
australopithecine.92demo.com
austria.92demo.com
austroasiatic.92demo.com
aut.92demo.com
autarch.92demo.com
autarchist.92demo.com
autarkist.92demo.com
autecious.92demo.com
autecism.92demo.com
autecologic.92demo.com
获取用户选定的文本
使用内置 getSelection 属性获取用户选择的文本。
const getSelectedText = () => window.getSelection().toString();
getSelectedText();
打乱数组
使用 sort 和 random 方法对数组进行打乱混合。
const shuffleArray = (arr) => arr.sort(() => 0.5 - Math.random());
console.log(shuffleArray([1, 2, 3, 4]));
// Result: [ 1, 4, 3, 2 ]
//代码效果参考:
检测用户是否处于暗模式
使用以下代码检查用户的设备是否处于暗模式。
const isDarkMode = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches
console.log(isDarkMode) // Result: True or False