You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: readMe.md
+43-4Lines changed: 43 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,6 +32,7 @@ programming language for four consecutive years and is the most used programming
32
32
Github
33
33
## Setup
34
34
First thing first, lets install text or code editor. Install code editor, it could be [vscode](https://code.visualstudio.com/), [atom](https://atom.io/), [bracket](http://brackets.io/), [notepad++](https://notepad-plus-plus.org/) or others. I recommend vscode.
35
+
Install either [Chrome](https://www.google.com/chrome/) or [Firefox](https://www.mozilla.org/en-US/firefox/new/?v=b) if you didn't have yet.
35
36
## Adding JavaScript to a web page
36
37
JavaScript can be added to a web pages in three ways:
37
38
****Inline script***
@@ -145,11 +146,49 @@ In JavaScript and also other programming languages there are different kinds of
145
146
Strings are text which are under ***single*** or ***double*** quote.
146
147
Lets' see some examples of string:
147
148
```js
148
-
let firstName ='Asabeneh'
149
-
let country ='Finland'
150
-
let city ='Helsinki'
151
-
let language ='JavaScript'
149
+
let firstName ='Asabeneh';
150
+
let lastName ='Yetayeh';
151
+
let country ='Finland';
152
+
let city ='Helsinki';
153
+
let language ='JavaScript';
154
+
let job ='teacher'
152
155
```
156
+
#### String Concatination
157
+
```js
158
+
// Declaring different variables of different data types
159
+
let firstName ='Asabeneh';
160
+
let lastName ='Yetayeh';
161
+
let country ='Finland';
162
+
let city ='Helsinki';
163
+
let language ='JavaScript';
164
+
let job ='teacher'
165
+
166
+
let fullName = firstName +""+ lastName; // concatination, merging to string together.
167
+
console.log(fullName);
168
+
169
+
170
+
let personInfoOne = fullName +".I am "+ age +". I live in "+ country; // ES5
171
+
let personInfoTwo =`I am ${fullName}.I am ${age}. I live in ${country}`; //ES6 - String interpolation method
172
+
let personInfoThree =`I am ${fullName}. I live in ${country}, ${city}. I am a ${job}. I teach ${language}.`
173
+
console.log(personInfoOne);
174
+
console.log(personInfoTwo);
175
+
//More Examples
176
+
var gravity =9.81;
177
+
var boilingPoint =100;
178
+
var bodyTemp =37;
179
+
180
+
/*
181
+
The boiling point of water is 100 oC.
182
+
Human body temperatue is 37 oC.
183
+
The gravity of earth is 9.81 m/s2.
184
+
*/
185
+
console.log(`The boiling point of water is ${boilingPoint} oC.\nHuman body temperatue is ${body} oC.\nThe gravity of earth is ${gravity} m / s2.`
186
+
);
187
+
188
+
189
+
```
190
+
191
+
153
192
#### Exercises:String
154
193
1. Declare a variable name company and assign it to an initial value **"Coding Academy"**.
155
194
1. Print the string on the browser console using *console.log()*
0 commit comments