I’m currently working on Tencent
I’m currently learning Node、TS
I’m looking to collaborate on Vue
- Follow me on Juejin
logic-training and code-everyday
I’m currently working on Tencent
I’m currently learning Node、TS
I’m looking to collaborate on Vue
let arr = [1,2,3,3,3,4,4,5,5,5,5,5,5,6,6,6,6,45,43,3,2,2,3,23]
let getMaxRepeat = (arr) => {
// todo
}
/*
* 实现的方法有很多种,
* 但是希望 以最简单、最清晰的思路实现
*/
<ul>
<li class='target'>
<span>test</span>
</li>
</ul>
class
为 target
的li
可以 alert 出其所含内容(如上方代码点击弹出“test”)ul
动态新增li
元素的情况下,也要有相同效果js
实现,不使用jQuery\Vue\React\Angular
等框架function sortArr(a, b) {
// todo...
}
/*
* 根据传入的数字,返回其中包含的最大的连续五位数
* e.g.
* maxFiveDigits(283910356876) // =>91035
* maxFiveDigits(123456) // => 23456
*/
function maxFiveDigits(num) {
//TODO:完成该函数
}
/*
* 如题
*/
要求:给定一个组合长度,输出由0和1在该长度内排列组合形成的二维数组。
例如:
function getArr( size ){
//TODO - 完成该方法
}
var arr = getArr(4); //给定组合长度为4
console.log( JSON.stringify(arr) );
/** 打印出:
[[0,0,0,0],[0,0,0,1],[0,0,1,0],[0,0,1,1],[0,1,0,0],[0,1,0,1],[0,1,1,0],[0,1,1,1],
[1,0,0,0],[1,0,0,1],[1,0,1,0],[1,0,1,1],[1,1,0,0],[1,1,0,1],[1,1,1,0],[1,1,1,1]]
****/
function compArrs(a, b) {
// todo...
}
/*
* 原生JS 实现 Promise 类 ( class )
* 1、基本能力实现
* 2、状态的管理
* 3、链式调用 的实现
*/
class Promise {
constructor() {
// todo
}
then() {
// todo
}
}
有这么几个变量:
实现一个函数 getArranging 可以返回它们的可能值的排列组合二维数组:
function getArranging( ){
//TODO - 返回参数的排列组合
}
var a = [0, 1];
var b = [3, 4, 5];
var c = [6, 7];
var ret = getArranging( a, b, c );
// ret 值为:
/**
[ [0,3,6], [0,3,7], [0,4,6], [0,4,7], [0,5,6], [0,5,7], [1,3,6], [1,3,7], [1,4,6], [1,4,7], [1,5,6], [1,5,7] ]
**/
/*
* 根据2019年 新个税政策计算,每月个人应缴纳 个人所得税
* e.g.
* // 年收入
* const yearIncome = [36000, 144000, 300000, 420000, 660000, 960000]
* // 对应不同阶段的税率
* const newTax = [3, 10, 20, 25, 30, 35, 45]
*
* 是否有 专项扣除
* const deduct = []
*
* calculateTax(salary, deductType)
*
* salary: 月薪
* deductType: 专项扣除类型,如果无 则为 0
*/
// 专项扣除 amount 代表每月 金额
const deduct = [
{
name: '子女教育',
type: 1,
amount: 1000
},
{
name: '继续教育',
type: 2,
amount: 400
},
{
name: '住房贷款利息',
type: 3,
amount: 1000
},
{
name: '住房租金',
type: 4,
amount: 1500
},
{
name: '赡养老人',
type: 5,
amount: 2000
},
{
name: '大病医疗',
type: 6,
amount: 6000
}
]
const calculateTax = (salary, deductType) => {
// todo
}
不使用loop循环,创建一个长度为100的数组,并且每个元素的值等于它的下标
据说是 某宝的笔试题,大家可以试一试
const getIdCard = () => {
const idCard = '42062419921218761X'
const computingCoefs = '7-9-10-5-8-4-2-1-6-3-7-9-10-5-8-4-2'.split('-')
const mapY = '0-1-2-3-4-5-6-7-8-9-10'.split('-')
const mapLastNumber = '1-0-X-9-8-7-6-5-4-3-2'.split('-')
// todo ...
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.