min js inverse logic