Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript For Validation

let student = {
    name: 'Jack',
    age: 24
}
const handler = {
    // get the object key and value
    get(obj, prop) {

    // check condition
    if (prop == 'name') {
      return obj[prop];
    } else {
      return 'Not allowed';
    }
  }
}
const proxy = new Proxy(student, handler);
console.log(proxy.name); // Jack
console.log(proxy.age); // Not allowed
Comment

PREVIOUS NEXT
Code Example
Javascript :: A closure Function 
Javascript :: search in javascript 
Javascript :: function statement js 
Javascript :: useeffect react 
Javascript :: how to remove first element of array in javascript 
Javascript :: object model javascript 
Javascript :: javascript expression interpolation 
Javascript :: rating 
Javascript :: react state lifting 
Javascript :: What do "module.exports" and "exports.methods" mean in NodeJS / Express 
Javascript :: Requiring express 
Javascript :: js or operator 
Javascript :: express framework 
Javascript :: .default in javascript 
Javascript :: best computer language 
Javascript :: where is brazil located 
Javascript :: you are working on javascript project.what you used to restart the innermost loop 
Javascript :: dockument anywhere click fucntion in js 
Javascript :: convert binary to string javascript 
Javascript :: capacitorjs get zip code example 
Javascript :: mongodb select all text not null 
Javascript :: Create an Alchemy Key javascript 
Javascript :: regex tester 
Javascript :: The Scratch Semicolon Glitch 
Javascript :: proet javascript web 
Javascript :: react prototype function 
Javascript :: Getting Nan when calculate two date js 
Javascript :: { "data": [ { "title": "", "img": "", "address": "" }, ] } json to html 
Javascript :: mdns javascript 
Javascript :: nodejs api to logged in users count on an application 
ADD CONTENT
Topic
Content
Source link
Name
8+6 =