Search posts, tags, users, and pages
In my last post on Metaprogramming we had a high level look at the JavaScript(ES6) Proxy. In this post, we are going to discuss about JavaScript Reflect APIs, another inclusion in ES6. First thing first, What is Reflect? Just before we go to underst...
Tapas Adhikary
@atapas · Bangalore
Educator @tapaScript | Founder CreoWis & ReactPlay - Writer - YouTuber - Open Source
Co-Founder, @CreoWis | Teacher, @tapaScript | Founder, @ReactPlay | YouTuber | Writer | Human
Markdown supported · ⌘↵ to post
Krishnadas PC
What difference will it make if I use code like this?
let logHandler = { get: function(target, fieldName) { console.log("Log: ", target[fieldName]); //return Reflect.get(target, fieldName); return target[fieldName] } };
Hey Krishnadas PC , that will work exactly the same as shown in the example. The example used Reflect to show how Proxy and Reflect can be used together.
Thanks for putting your points.
Krishnadas PC
What difference will it make if I use code like this?
let logHandler = { get: function(target, fieldName) { console.log("Log: ", target[fieldName]); //return Reflect.get(target, fieldName); return target[fieldName] } };