@@ -57,3 +57,120 @@ myVar--;
57
57
var myDecimal = 10.56 ;
58
58
var decimalMultiplication = 2.5 * 2.5 ;
59
59
var decimalDivision = 10.2 / 2.5 ;
60
+
61
+ //remainder in java script using modulus "%""
62
+ var remainder ;
63
+ remainder = 15 % 2 ;
64
+
65
+ //augmented addition and subtraction js
66
+ var a = 2 ;
67
+ var b = 3 ;
68
+ var c = 5 ;
69
+
70
+ a += 10 ;
71
+ b += 12 ;
72
+ c += 15 ;
73
+ console . log ( a ) //gives12
74
+ console . log ( b ) //15
75
+ console . log ( c ) //20
76
+
77
+ var a = 10 ;
78
+ var b = 9 ;
79
+ var c = 3 ;
80
+
81
+ a -= 3 ;
82
+ b -= 5 ;
83
+ c -= 5 ;
84
+ console . log ( a ) //gives 7
85
+ console . log ( b ) //4
86
+ console . log ( c ) //-2
87
+
88
+ var a = 5 ;
89
+ var b = 12 ;
90
+ var c = 4.6 ;
91
+
92
+ // Only modify code below this line
93
+
94
+ a *= 5 ;
95
+ b *= 3 ;
96
+ c *= 10 ;
97
+ console . log ( a ) //gives 25
98
+ console . log ( b ) //36
99
+ console . log ( c ) //46
100
+
101
+ var a = 48 ;
102
+ var b = 108 ;
103
+ var c = 33 ;
104
+
105
+ // Only modify code below this line
106
+
107
+ a /= 12 ;
108
+ b /= 4 ;
109
+ c /= 11 ;
110
+ console . log ( a ) //gives 4
111
+ console . log ( b ) // 27
112
+ console . log ( c ) //3
113
+
114
+ //String variables
115
+ // Example
116
+ var firstName = "Alan" ;
117
+ var lastName = "Turing" ;
118
+
119
+ // Only change code below this line and create your new Name
120
+ var myFirstName = "Owen" ;
121
+ var myLastName = "Timz" ;
122
+
123
+ //escaping literal quotes in strings using back slashes
124
+ var myStr = "I am \"double quoted\" string inside \"double quotes\"" ;
125
+
126
+ //quoting strings with single quotes
127
+ var myString = '\"I am coming today\" said the master ' ;
128
+
129
+ //escape sequences
130
+ /*
131
+ Code Output
132
+ FirstLine
133
+ \SecondLine
134
+ ThirdLine
135
+
136
+ \' single quote
137
+ \" double quote
138
+ \\backslash
139
+ \ n newline
140
+ \ r carriage return
141
+ \ t tab
142
+ \ b word boundary
143
+ \ f form feed
144
+ */
145
+ var myStr = "FirstLine\n\t\\\SecondLine\nThirdLine" ;
146
+
147
+ //String Concatenation with + operator
148
+ // =+ operator concatenation
149
+ //String with variables concatenation
150
+ //appending variables to string
151
+ var ourStr = "I come first. " + "I come second." ;
152
+ var myStr = "This is the start." + " This is the end." ;
153
+ // += operator concatenation
154
+ var ourStr = "I come first. " ;
155
+ ourStr += "I come second." ;
156
+
157
+ var myStr = "This is the first sentence. " ;
158
+ myStr += "This is the second sentence."
159
+
160
+ // using String concatenation with +=
161
+ var ourName = "freeCodeCamp" ;
162
+ var ourStr = "Hello, our name is " + ourName + ", how are you?" ;
163
+
164
+ var myName = "owen" ;
165
+ var myStr = "My name is " + myName + " and I am well!" ;
166
+
167
+ //using appending to concatenate Strings
168
+ var anAdjective = "awesome!" ;
169
+ var ourStr = "freeCodeCamp is " ;
170
+ ourStr += anAdjective ;
171
+
172
+ var someAdjective = "using Android studio" ;
173
+ var myStr = "You can develop mobile apps " ;
174
+ myStr += someAdjective ;
175
+
176
+ //finding Lengths os Strings character
0 commit comments