Coder Social home page Coder Social logo

js_task_answers's Issues

typeof(null)

if ( typeof(a) === 'string' && typeof(a) != null && typeof(b) != null

typeof(null) - возвращает "object". "object" не может сравниваться с null;

let answer = null;
if(answer == null) { 
  break;
}

// typeof(answer) == null - не будет работать, потому что сравниваться будет "object" == null
В последующих задачах/файлах такой же код.
Если будет задача что-то сделать при "Cancel - null" от пользователя, то такое сравнение никогда не сработает

detectLevel() dont check boundary values

function detectLevel() { // Расчет уровня достатка
if (appData.moneyPerDay < 100) {
console.log ("Это минимальный уровень достатка!");
} else if (appData.moneyPerDay > 100 && appData.moneyPerDay < 2000) { /
console.log ("Это средний уровень достатка!");
} else if (appData.moneyPerDay > 2000) {
console.log ("Это высокий уровень достатка!");
} else {
console.log ("Ошибочка...!");
}
}
detectLevel();

//не учтены значения 100 и 2000 - код идет по ветке else

Вопрос к четвёртой практической части

toggleVisibleMyDB: function() {

Мы создаём метод toggleVisibleMyDB, котоорый проверяет приватность нашей датабазы и меняет его на обратный. А для чего его проверять? Нельзя ли просто в методе сделать так, чтобы при его вызове приватность менялась на обратную?
Например: personalMovieDB.privat = !personalMovieDB.privat;

Спасибо за ответ.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.