2020-05-10 从JavaScrip到完成指定项目Kelvin Weather温度转换

206 阅读1分钟

入门简介

根据左侧栏指导,完成右侧的代码任务。

复习Review

Let’s take one more glance at the concepts we just learned:

• Data is printed, or logged, to the console, a panel that displays messages, with console.log(). • We can write single-line comments with // and multi-line comments between /* and */. • There are 7 fundamental data types in JavaScript: strings, numbers, booleans, null, undefined, symbol, and object. • Numbers are any number without quotes: 23.8879 • Strings are characters wrapped in single or double quotes: 'Sample String' • The built-in arithmetic operators include +, -, *, /, and %. • Objects, including instances of data types, can have properties, stored information. The properties are denoted with a . after the name of the object, for example: 'Hello'.length. • Objects, including instances of data types, can have methods which perform actions. Methods are called by appending the object or instance with a period, the method name, and parentheses. For example: 'hello'.toUpperCase(). • We can access properties and methods by using the ., dot operator. • Built-in objects, including Math, are collections of methods and properties that JavaScript provides.

Review Variables

Nice work! This lesson introduced you to variables, a powerful concept you will use in all your future programming endeavors.

Let’s review what we learned:

• Variables hold reusable data in a program and associate it with a name. • Variables are stored in memory. • The var keyword is used in pre-ES6 versions of JS. • let is the preferred way to declare a variable when it can be reassigned, and const is the preferred way to declare a variable with a constant value. • Variables that have not been initialized store the primitive data type undefined. • Mathematical assignment operators make it easy to calculate a new value and assign it to the same variable. • The + operator is used to concatenate strings including string values held in variables • In ES6, template literals use backticks ` and ${} to interpolate values into a string. • The typeof keyword returns the data type (as a string) of a value.

概述

疑问

Kelvin Weather温度转换项目

反思总结

在完成最后2行代码,要输出转换的度数时,却没有结果,去CodeCademy和google搜索了,才知道我的引用文字的符号打错了。正确的是`(在键盘左上角),我打错成’ ,它们实在太小而去看起来太像了。改正后,才正确输出结果。