原文:https://segmentfault.com/a/1190000010159725 本文翻译自 Nicolas Bevacqua 的书籍 《Practical Modern JavaScript》,这是该书的第二章。翻译采用意译,部分内容与原书有所不同。 本章翻译时我最大的收获有以下几点: ...
分类:
其他好文 时间:
2020-07-15 15:40:00
阅读次数:
60
要实现的效果:如果上面元素较少,提交按钮在屏幕底部,如果上面元素较多,接近一屏,或者超过一屏,按钮随之下移。 需要以下几点: 1、按钮和上面元素在一个div中,父div相对定位,需要居底的div绝对定位。 2、父div min-height: 100vh。 3、父div设一个伪类,伪类设置一定高度, ...
分类:
Web程序 时间:
2020-07-15 15:32:18
阅读次数:
425
(一)时间戳转为当前时间 var a = 1594810549 console.log(timestampToTime(a)) //2020-07-15->18:55:49 function timestampToTime(timestamp){ var date = new Date(timest ...
分类:
其他好文 时间:
2020-07-15 15:09:09
阅读次数:
68
Angle Between Hands of a Clock (M) 题目 Given two numbers, hour and minutes. Return the smaller angle (in degrees) formed between the hour and the minut ...
分类:
其他好文 时间:
2020-07-15 10:47:17
阅读次数:
102
给定一个三角形,找出自顶向下的最小路径和。每一步只能移动到下一行中相邻的结点上。 相邻的结点 在这里指的是 下标 与 上一层结点下标 相同或者等于 上一层结点下标 + 1 的两个结点。 例如,给定三角形: [ [2], [3,4], [6,5,7], [4,1,8,3]]自顶向下的最小路径和为 11 ...
分类:
其他好文 时间:
2020-07-15 01:20:07
阅读次数:
66
原来一直没太搞懂,今天大力搞了搞,感觉比较可了 latex取反是\sim \[ 把数拆成二进制数 所以我们最多只需要2^{n+1}-1的十进制数就好(二进制形式是n个1)\\ 1.判断一个数字x二进制下第i位是不是1(假设最低为第1位)\\ if(1 << (i-1)\&x) 操作\\ 2.将一个数 ...
分类:
其他好文 时间:
2020-07-14 20:04:31
阅读次数:
70
Math方法 // 常量数据不能修改 console.log(Math.PI); console.log(Math.SQRT2); console.log(Math.SQRT1_2); // Math.PI/180*60 ? // abs 绝对值 非负值 console.log(Math.abs(- ...
分类:
Web程序 时间:
2020-07-14 18:47:02
阅读次数:
82
class Solution { public int maxPathSum(TreeNode root) { dfs(root); return res; } int res = Integer.MIN_VALUE; public int dfs(TreeNode root) { // 返回以当前 ...
分类:
其他好文 时间:
2020-07-14 18:15:42
阅读次数:
58
string.gsub(mainString,findString,replaceString,num) 在字符串中替换 mainString 为要操作的字符串, findString 为被替换的字符,replaceString 要替换的字符,num 替换次数 string.reverse(arg) ...
分类:
其他好文 时间:
2020-07-14 16:49:19
阅读次数:
60