Простое общение с пользователем 


Мы поможем в написании ваших работ!



ЗНАЕТЕ ЛИ ВЫ?

Простое общение с пользователем



 

 

About typof

Операнд следует за оператором typeof: typeof operand

  operand является выражением, представляющим объект или примитив, тип которого должен быть возвращен


Описание

В следующей таблице приведены возможные возвращаемые значения typeof. Дополнительная информация о типах и примитивах находится на странице структуры данных JavaScript.

Type Result
Undefined "undefined"
Null "object" (смотрите ниже)
Boolean "boolean"
Number "number"
String "string"
Symbol (новый тип из ECMAScript 2015) "symbol"
Host object (определено JS окружением) Зависит от реализации
Function object (реализует [[Call]] в терминах ECMA-262) "function"
Любой другой тип "object"

Примеры // Числаtypeof 37 === 'number';typeof 3.14 === 'number';typeof(42) === 'number';typeof Math.LN2 === 'number';typeof Infinity === 'number';typeof NaN === 'number'; // несмотря на то, что это "Not-A-Number" (не число)typeof Number(1) === 'number'; // никогда не используйте эту запись! // Строкиtypeof '' === 'string';typeof 'bla' === 'string';typeof '1' === 'string'; // обратите внимание, что число внутри строки всё равно имеет тип строкиtypeof (typeof 1) === 'string'; // typeof всегда вернёт в этом случае строкуtypeof String('abc') === 'string'; // никогда не используйте эту запись! // Booleanstypeof true === 'boolean';typeof false === 'boolean';typeof Boolean(true) === 'boolean'; // никогда не используйте эту запись! // Символыtypeof Symbol() === 'symbol'typeof Symbol('foo') === 'symbol'typeof Symbol.iterator === 'symbol' // Undefinedtypeof undefined === 'undefined';typeof declaredButUndefinedVariable === 'undefined';typeof undeclaredVariable === 'undefined'; // Объектыtypeof {a: 1} === 'object'; // используйте Array.isArray или Object.prototype.toString.call// чтобы различить обычные объекты и массивыtypeof [1, 2, 4] === 'object'; typeof new Date() === 'object'; // То что ниже приводит к ошибкам и проблемам. Не используйте!typeof new Boolean(true) === 'object';typeof new Number(1) === 'object';typeof new String('abc') === 'object'; // Функцииtypeof function() {} === 'function';typeof class C {} === 'function';typeof Math.sin === 'function';

Интерполяция (ES6)

Прямо внутри строки можем вставлять значения переменной

До ES6

Problems begin when

Дабы избежать этого был придуман приём – интерполяция

Особенность –  в косых кавычках  ` ` - бектики

 

Можно использовать так

 

Операторы в JS

 

https://developer.mozilla.org/ru/docs/Web/JavaScript/Reference/Operators/Operator_Precedence#Table

 

Практическое задание

My cod

const numberOfFilms = +prompt("How many do you whatched films?", "");

a = prompt("What was the last movie you watched?", "");

b = prompt("Your appraisal", "");

 

const personalMovieDB = {

count: numberOfFilms,

movies: {

a: a,

b: b

},

actors: {},

genres: [],

privat: false

};

 

console.log(personalMovieDB.count);

console.log(personalMovieDB.movies);

 

teacher cod

  ключ [a]: значение b

При использовании кирилицы использовать синтаксис через [] ибо при введении неочивидных данных (аврваоор авпрварпр титаол ьбюб), в объекте он не отразиться  как строка, а будет типо

Git

Для инициализации

git init – подключаем git on project

git config –local/global user.name "Abu" If you have never used git before- global

git config –global/ local user.email "my_email@whatever.com"

У файлов три статуса

git status

(use "git add <file>..." to include in what will be committed)

   index.html

   script.js

• Файлы просто созданы, за ними не следят

git add –A следим за всеми файлами; git add failName.css - выборочно or

git add *.css – все файлы css

Changes to be committed:

(use "git rm --cached <file>..." to unstage)

   new file: index.html

   new file: script.js

• Git следить за файлами и можно создать уже commit

 

git commit –a  –m ” что сделано на этой контрольной точке”

git log вытаскиваю инфу о всех commit

• Создание commita

Заливаем на репозиторий Git Hub

…or create a new repository on the command line

echo "# JS_Beginners" >> README.mdgit initgit add README.mdgit commit -m "first commit"git remote add origin https://github.com/AbuFarm/JS_Beginners.gitgit push -u origin master

…or push an existing repository from the command line

 

Добавление название репозитория

git remote add origin https://github.com/AbuFarm/JS_Beginners.git - связаваем локальный репозиторий с Git Рги             ветка      
git push -u origin master – backup репозитория с локального на удалённый все пуши будут пушиться

…or import code from another repository

You can initialize this repository with code from a Subversion, Mercurial, or TFS project.

-q, --quiet suppress summary after successful commit

-v, --verbose show diff in commit message template

 

Commit message options

-F, --file <file> read message from file

--author <author> override author for commit

--date <date> override date for commit

-m, --message <message>

commit message

-c, --reedit-message <commit>

reuse and edit message from specified commit

-C, --reuse-message <commit>

reuse message from specified commit

--fixup <commit> use autosquash formatted message to fixup specified commit

--squash <commit> use autosquash formatted message to squash specified commit

--reset-author the commit is authored by me now (used with -C/-c/--amend)

-s, --signoff add Signed-off-by:

-t, --template <file>

use specified template file

-e, --edit force edit of commit

--cleanup <mode> how to strip spaces and #comments from message

--status include status in commit message template

-S, --gpg-sign[=<key-id>]

GPG sign commit

 

Commit contents options

-a, --all commit all changed files

-i, --include add specified files to index for commit

--interactive interactively add files

-p, --patch interactively add changes

-o, --only commit only specified files

-n, --no-verify bypass pre-commit and commit-msg hooks

--dry-run show what would be committed

--short show status concisely

--branch show branch information

--ahead-behind compute full ahead/behind values

--porcelain machine-readable output

--long show status in long format (default)

-z, --null terminate entries with NUL

--amend amend previous commit

--no-post-rewrite bypass post-rewrite hook

-u, --untracked-files[=<mode>]

show untracked files, optional modes: all, normal, no. (Default: all)

--pathspec-from-file <file>

read pathspec from file

--pathspec-file-nul with --pathspec-from-file, pathspec elements are separated with NUL character

 

Условие в JS

Тернарный оператор

 

Участвует три выражение

Бинарный: 4 + 4

Унарный: + ‘4’

 

 

Switch – строгое сравненик ===

Шаблон работы swicth 

const num = 50;   switch (num) { case 49: console.log("Неверно"); break; case 100: console.log("Неверно"); break; case 50: console.log("В точку"); break; default: console.log("Не в этот раз"); break; }   break – прерывание операции при выполнения условия continium – позволяет пропустить тот шаг, который не нужен, не прерывая полностью цикл default – команда, если не подошло не одно из условий   Со строками работает точно также

 

 



Поделиться:


Последнее изменение этой страницы: 2021-07-18; просмотров: 149; Нарушение авторского права страницы; Мы поможем в написании вашей работы!

infopedia.su Все материалы представленные на сайте исключительно с целью ознакомления читателями и не преследуют коммерческих целей или нарушение авторских прав. Обратная связь - 3.144.86.134 (0.015 с.)