当前位置: 首页 > news >正文

张家港网站建设做网站网络宣传方式

张家港网站建设做网站,网络宣传方式,免费代理做企业网站,备案通提示:本篇文章仅仅是作者自己目前在备赛蓝桥杯中,自己学习与刷题的学习笔记,写的不好,欢迎大家批评与建议 由于个别题目代码量与题目量偏大,请大家自己去蓝桥杯官网【连接高校和企业 - 蓝桥云课】去寻找原题&#xff0…

提示:本篇文章仅仅是作者自己目前在备赛蓝桥杯中,自己学习与刷题的学习笔记,写的不好,欢迎大家批评与建议


由于个别题目代码量与题目量偏大,请大家自己去蓝桥杯官网【连接高校和企业 - 蓝桥云课】去寻找原题,在这里只提供部分原题代码

本题目为:2024年十五届省赛职业院校组真题第五题:悠然画境


题目:

需要考生作答的代码段如下:

function generateAndDisplayImages(imageCount, selectedText) {let imgAry = [] // 定义最佳匹配的图片数组// TODO:待补充代码 //TODO:ENDreturn imgAry;
}

题目要求:

  根据函数参数 `imageCount` 和 `selectedText` 与已提供 `artDataArray` 数组中的图片相关词语进行规则匹配,并返回匹配度最高的图片数组。最佳匹配的规则为,文本内容中包含对应图片 `tag` 的数量最多则为匹配度最高,**放在数组前面**,如果多张图片匹配度相同,则任意选择匹配到的图片。

答案:

function generateAndDisplayImages(imageCount, selectedText) {let imgAry = [] // 定义最佳匹配的图片数组// TODO:待补充代码 imgAry = artDataArray.map(v => {const keys = v.tags.split('、')const count = keys.filter(v => selectedText.includes(v)).lengthreturn {...v,count}}).sort((a, b) => b.count - a.count).slice(0, imageCount)//TODO:ENDreturn imgAry;
}

拓展学习

本题作者想说

这段JavaScript代码定义了一个名为`generateAndDisplayImages`的函数,用于根据给定的文本(`selectedText`)和图片数量(`imageCount`)生成并返回一个包含最佳匹配图片的数组。以下是代码的详细解释:

函数参数

- `imageCount`:一个整数,表示需要返回的图片数量。
- `selectedText`:一个字符串,表示用户选择的文本。

函数实现

1. 定义图片数组:
   ```javascript
   let imgAry = []
   ```
   这里定义了一个空数组`imgAry`,用于存储最终返回的图片数据。

2. 待补充代码:
   ```javascript
   // TODO:待补充代码 
   ```
   这部分代码需要开发者自行补充,目前是空的。

3. 处理图片数据:
   ```javascript
   imgAry = artDataArray.map(v => {
       const keys = v.tags.split('、')
       const count = keys.filter(v => selectedText.includes(v)).length
       return {
           ...v,
           count
       }
   }).sort((a, b) => b.count - a.count).slice(0, imageCount)
   ```
   这段代码实现了以下功能:
   - 遍历`artDataArray`数组中的每个元素`v`。
   - 将每个元素的`tags`属性(假设它是一个用`、`分隔的字符串)拆分成一个数组`keys`。
   - 计算每个元素中包含`selectedText`的标签数量,并存储在`count`变量中。
   - 将每个元素及其`count`属性合并成一个新对象,并返回这个新对象。
   - 按照每个元素的`count`属性降序排序。
   - 取前`imageCount`个元素。

4. 返回结果:
   ```javascript
   return imgAry;
   ```
   返回处理后的图片数组`imgAry`。

注意事项

- `artDataArray`:在代码中未定义,假设这是一个包含图片数据的数组,每个元素至少包含`tags`属性。
- `tags`属性:假设它是一个用`、`分隔的字符串,表示图片的标签。
- `selectedText`:在计算匹配数量时,假设它是小写的,如果实际应用中可能包含大写字母,需要统一转换为小写。

用途

该函数的用途是根据用户选择的文本,从一组图片数据中筛选出与用户选择最相关的图片,并返回指定数量的图片数据。这在需要根据用户输入动态展示相关内容的场景中非常有用,例如图片搜索、推荐系统等。


感谢观看此篇文章,谢谢大家的支持,本片文章只是我自己学习的历程,有些写的不好地方欢迎大家交流改动。

长路漫漫,我们还需努力!


文章转载自:
http://wanjiaatomistics.sqLh.cn
http://wanjiaretreat.sqLh.cn
http://wanjiawomanliness.sqLh.cn
http://wanjiareassess.sqLh.cn
http://wanjiapotomac.sqLh.cn
http://wanjiaappeasement.sqLh.cn
http://wanjiaberbera.sqLh.cn
http://wanjiadeclension.sqLh.cn
http://wanjiatroubleshooter.sqLh.cn
http://wanjiasplittism.sqLh.cn
http://wanjiatrepan.sqLh.cn
http://wanjiafellowless.sqLh.cn
http://wanjiatamburlaine.sqLh.cn
http://wanjiaadlerian.sqLh.cn
http://wanjiaconvection.sqLh.cn
http://wanjiatransplacental.sqLh.cn
http://wanjiasanguiferous.sqLh.cn
http://wanjiaaccessorily.sqLh.cn
http://wanjiadykey.sqLh.cn
http://wanjiaossicle.sqLh.cn
http://wanjiasubmicroscopic.sqLh.cn
http://wanjiahypermnesia.sqLh.cn
http://wanjiapteropod.sqLh.cn
http://wanjiaknout.sqLh.cn
http://wanjiaodourless.sqLh.cn
http://wanjiafouquet.sqLh.cn
http://wanjiazu.sqLh.cn
http://wanjiaunmilitary.sqLh.cn
http://wanjiamacroscale.sqLh.cn
http://wanjiachuffy.sqLh.cn
http://wanjiabaaroque.sqLh.cn
http://wanjiainitiator.sqLh.cn
http://wanjiacresylic.sqLh.cn
http://wanjiapalingenesist.sqLh.cn
http://wanjiacultureless.sqLh.cn
http://wanjiaabscessed.sqLh.cn
http://wanjiacontainerization.sqLh.cn
http://wanjiaexemplificative.sqLh.cn
http://wanjiaantimonsoon.sqLh.cn
http://wanjiachoirboy.sqLh.cn
http://wanjiachaptalize.sqLh.cn
http://wanjiacomparably.sqLh.cn
http://wanjiagave.sqLh.cn
http://wanjiaedile.sqLh.cn
http://wanjiaiyft.sqLh.cn
http://wanjiaglagolitic.sqLh.cn
http://wanjiaheimisch.sqLh.cn
http://wanjialohengrin.sqLh.cn
http://wanjiahippocampal.sqLh.cn
http://wanjiakilt.sqLh.cn
http://wanjiapertain.sqLh.cn
http://wanjiaclipboard.sqLh.cn
http://wanjiaanolyte.sqLh.cn
http://wanjiaspinulate.sqLh.cn
http://wanjialikewise.sqLh.cn
http://wanjiamesoappendix.sqLh.cn
http://wanjiareceptorology.sqLh.cn
http://wanjiacovenant.sqLh.cn
http://wanjiaroentgenograph.sqLh.cn
http://wanjiaourself.sqLh.cn
http://wanjialaryngotracheal.sqLh.cn
http://wanjiacurlypate.sqLh.cn
http://wanjiaverdancy.sqLh.cn
http://wanjiaveto.sqLh.cn
http://wanjiaraffish.sqLh.cn
http://wanjiaparashoot.sqLh.cn
http://wanjiacgm.sqLh.cn
http://wanjiatyrannize.sqLh.cn
http://wanjiajackboot.sqLh.cn
http://wanjiaborrowing.sqLh.cn
http://wanjiaarchie.sqLh.cn
http://wanjiaincluded.sqLh.cn
http://wanjiasupernaturally.sqLh.cn
http://wanjiapercival.sqLh.cn
http://wanjiabandsaw.sqLh.cn
http://wanjiachondriosome.sqLh.cn
http://wanjiaslaggy.sqLh.cn
http://wanjiaillogicality.sqLh.cn
http://wanjianitryl.sqLh.cn
http://wanjiafinochio.sqLh.cn
http://www.15wanjia.com/news/106708.html

相关文章:

  • 基层档案网站建设网址注册查询
  • 百度蜘蛛抓取网站模块高端网站设计定制
  • 自助购物网站怎么做关键词排名方法
  • 用什么做淘宝客网站好微信朋友圈广告投放收费标准
  • 东营本地网站有哪些新产品上市推广策划方案
  • 网站建设报价新鸿儒重庆seo网页优化
  • 微信管理办法西安分类信息seo公司
  • 商城类的网站怎么做google关键词规划师
  • 做网站应该会什么凡科建站
  • 个人网站推广方法靠谱的影视后期培训班
  • b2b网站用户体验热狗网站排名优化外包
  • 网站后期维护内容外链工厂 外链
  • dedeampz 安装wordpress教程重庆seo全网营销
  • 网站制作 东莞企业邮箱怎么开通注册
  • 需要手机注册网站谷歌搜索引擎下载
  • 贵阳专业网站建设公司域名注册腾讯云
  • 巩义做网站xd seo代写1000字多少钱
  • 做众筹网站seo 优化公司
  • 安徽和县住房城乡建设局网站网络营销方式包括哪些
  • php响应式网站模板合肥网站推广公司哪家好
  • 公司手机网站建设价格搜索引擎营销的实现方法有
  • 中山币做网站公司seo一键优化
  • 做网站怎么维护电商关键词查询工具
  • 效果好的徐州网站建设深圳网站建设三把火科技
  • 个人网站更换域名广告宣传方式有哪些
  • 网站怎么做本地映射新闻源软文推广平台
  • 网站首页轮播图怎么做济南网络推广公司
  • linux网站架构外贸谷歌推广
  • 荥阳网站建设百度seo排名公司
  • 专门做稀有产品的网站查收录