Check Status object
 1 check Null and Undefined And primative datatype
if(object){
// object is not
null, undefined, 0, '', false.
 but it can empty({}) 
}
example 
let varNull = null;
let varUndefined = undefined;
let varNumber = 0;
let varString = '';
let varBoolean = false;
if(!varNull){  // means if varNull is null => into block it and view console
  console.log('varNull'); // it view 
}
if(varNull){  // means if varNull not null => not into block it and view console
  console.log('varNull'); // it not view 
}
 if(!varUndefined){
  console.log('varUndefined'); //view
}
if(!varNumber){
  console.log('varNumber'); // view
}
if(!varString){
  console.log('varString'); //view
}
if(!varBoolean){
  console.log('varBoolean'); //view
} 
2 Check empty object
if(Object.keys(object).length === 0 && object.constructor == Object){
// object not empty
// let object = {
a: 111,
    ... 
    } 
}
3 Check All
if(object && Object.keys(object).length === 0 && object.constructor === Object){
// not null
// not underfined
// not empty
}
referencen: https://stackoverflow.com/questions/679915/how-do-i-test-for-an-empty-javascript-object 
0 comments :
About Me
- Peter
 - Tân An, Long An, Vietnam
 - Hello everyone, I love programming, I love making friends with people all over the world.
 
Contact
Popular Posts
- 
Preface Trong java có 3 kiểu so sánh đặc trưng như sau: + Sử dụng toán tử == : return Boolean Primitive thì so sánh giá trị thực, Reference ...
 - 
1 Copy Object in java Use = for immutable class ex: Integer , String or Wrapper classes Object Use Contructor has paramater copy, ObjectA...
 - 
The cookie contains three part: username: to identify logged-in expirationTime: to expire the cookie; default 2 week password and pridefine...
 - 
Preface Khái niệm Oauth và ApIs Scope and consent (phạm vi và sự đồng ý) Oauth Actor Oauth Tokens Front Back Channel Giả Xác thực Với Oa...
 - 
1) The order of the antMatchers() Note that the order of the antMatchers() elements is significant – the more specific rules need to come ...
 - 
Knowledge of collection in java Interface Iterator interface Collection interface List Interface Queue Interface Deque Interface Se...
 - 
Persistence Context has two implemnet is JPA EntityManage and Hiberbate Session Example use Session of hiberate has exist github you can vi...
 - 
For immutableuse equallist we simple use list.equal list it return true if content same. (compare index) //case true List<Integer> l...
 - 
1) CRUD có thể sử dung find Compositekey hoặc findBy compositeket + column in composite 2) CRUD findBy column And column 3 Not LazyLoa...
 - 
1 check Null and Undefined And primative datatype if(object){ // object is not null, undefined, 0, '', false. but it can empty({})...
 
Post a Comment