自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(8)
  • 收藏
  • 关注

原创 CodeWars Josephus Permutation

Josephus Permutation【JavaScript】题目描述This problem takes its name by arguably the most important event in the life of the ancient historian Josephus: according to his tale, he and his 40 soldiers were trapped in a cave by the Romans during a siege.Refusin

2022-03-18 15:11:14 162 1

原创 CodeWars Most frequently used words in a text

Most frequently used words in a text【javaScript】题目描述Write a function that, given a string of text (possibly with punctuation and line-breaks), returns an array of the top-3 most occurring words, in descending order of the number of occurrences.Assumptio

2022-03-18 14:58:52 308

原创 js使用面向对象实现简易购物车

1.效果1.初始状态2.添加数量和删除数据3.向购物车中添加新的商品2.html文件1.购物车<table> <thead> <tr> <th>商品名称</th> <th>数量</th> <th>单价</th> <th>小计</th> <th>操作</th> &lt

2021-04-15 11:55:02 815 6

原创 js动态创建表格

1.body内容 <body> <div style=" width:450px; margin: auto;"> <input type="text" value=""/>行 <input type="text" value=""/>列 <button type="button">添加</button> </div> </body>2.script内容<script&

2021-04-01 00:34:03 1408 15

原创 js编写函数将数组的重复元素去掉,并返回新数组

js编写函数norepeat(arr)将数组的重复元素去掉,并返回新数组<script> var arr = [1,2,3,4,4,4,5,7,1,8,9,3,10,15,4,9]; function norepeat(arr){ for(var i=0;i<arr.length;i++){ for(var j=i+1;j<arr.length;j++){ if(arr[i]==arr[j]){ arr.splice(j,1);//splice[起始

2021-03-31 18:00:53 2066

原创 js统计字符串中每个字符的个数。(原始字符串是:“aabccdeefff”,结果是:a2 b1 c2 d1 e2 f3)

javascript统计字符串中每个字符的个数。(原始字符串是:“aabccdeefff”,结果是:a2 b1 c2 d1 e2 f3)var str = "aabccdeefff"; var arr = str.split(""); console.log(arr); var strNew = []; var count = 1;//计算重复次数 var countStr = [];//存放重复次数 for(var i=0;i<arr.length;i++){ if(strNe

2021-03-30 08:50:56 855 4

原创 js生成数字字母混合验证码。(例:6yF3)

javascript生成数字字母混合验证码。var arr = []; for(var i=0;i<4;i++){ do{ //去掉除数字字母外的特殊符号 var num = parseInt(Math.random()*1000)%(122-48+1); num += 48; }while(num>57&&num<65 || num>90&&num<97) arr[i] = String.fromCharCode(n

2021-03-30 08:46:30 717

原创 js实现已知某年某月某日是星期几,输入一个年月日(1980~2030),求得该日为星期几

js实现已知某年某月某日是星期几,输入一个年月日(1980~2030),求得该日为星期几<script> //1980.1.1星期二 闰年 function decide(date){ //判断星期几 var currentYear,currentMonth,currentDay,x,y;//当前年月日 var count,days,q,isLeapYear;//count:闰年计数 days:此年此月前共有多少天 q:从1980年至今总天数并用7取模

2021-03-26 16:44:59 505

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除