![](https://img-blog.csdnimg.cn/20200217100920356.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
JS-字节灵动
Javascript让旋律环绕
pkmer
理论锻炼思维,理论指导实践,知行合一。
展开
-
javascript Object 属性
属性合并let a = {name: 'hello'}let b = {...a,age: 23}// {name: "hello", age: 23}深拷贝anathorObj = JSON.parse(JSON.stringfy(obj))原创 2020-04-10 14:54:10 · 120 阅读 · 0 评论 -
遍历Object属性
for loopslet obj = {name: "Q10",email: "jj@gmail.com"}const content = []for(let key in obj){ content.push(obj[key])}console.log(content) // ["Q10", "jj@gmail.com"]原创 2020-04-04 22:47:03 · 138 阅读 · 0 评论 -
javascript property access
Array又不是Arrayarray是一个object,property access访问后,typeof不再是array,而是object,但是仍然具有array的属性和方法。var y = []y[0]=true;y.name="can you see me";y[10]=true;y['11'] = true y['twelve'] = truey.push(true) /...原创 2020-03-20 07:46:00 · 161 阅读 · 0 评论 -
javascript-Object
遍历属性for (const key in Object)如在vue场景中,通过子组件一次性更新父组件的值 data () { return { right: { 'crightName': null, 'crightImage': null, 'crightContent': null } }meth...原创 2020-03-13 16:04:27 · 113 阅读 · 0 评论 -
javascript this key world understand
这个例子能更好的理解this代表的是运行时,动态代理的对象。function ask(question) { console.log(this.teacher,question);}function otherClass() { let myContext = { teacher: "Suzy3" } ask.call(myContext,"why...原创 2020-03-19 07:54:21 · 140 阅读 · 0 评论 -
Array's Method
filter// Array's filterconst nums = [1,2,3,4,5,6,7];let res = nums.filter(n => n>5);console.log(res);参考Medium: Map, Filter and Reduce – Animated过滤会员卡的选项的校验let card = [ {score: 60...原创 2020-03-16 12:41:38 · 110 阅读 · 0 评论 -
Interacting with browser
We can get an element reference from the DOM,so that we can interacte with the page.document is created by the browser原创 2020-03-13 21:57:59 · 157 阅读 · 0 评论 -
function
Function有两种方法来创建functionfunction declarationfunction expressionfunction declarationIn Javascript, function declarations hoist the function definitions.(能够提升声明)// invoking the function greet()...原创 2020-03-12 08:11:37 · 198 阅读 · 0 评论 -
Loops Flow
for (let i = 0; i < 3; i++) { console.log(`in loops: ${i}`);}// 报错: sandbox.js:4 Uncaught ReferenceError: i is not defined// console.log(`out loops: ${i}`);for (var j = 0; j < 3; j++) ...原创 2020-03-11 08:29:33 · 138 阅读 · 0 评论 -
01-Modern Javascript Basic
变量声明letconst 固定不能赋予新值,且必须初始化var (之前声明变量的方式)Data typeStringString basic// String 可用单引号,也可用双引号let name = 'Q10Viking'let email = "1193094618@qq.com"// String concatenationconsole.log(name+...原创 2020-03-10 00:34:43 · 166 阅读 · 0 评论 -
01-Array-装甲车
splice(位置)-> “删除 || 替换 || 插入”数组的splice方法官网文档根据下标对元素的操作。删除const months = ['Jan', 'March', 'April', 'June'];months.splice(1,1) // 删除位置1的一个元素// Array ["Jan", "April", "June"] const month...原创 2020-02-17 10:34:49 · 89 阅读 · 0 评论