• Complain

TAM - JAVASCRIPT CODING EXERCISES: Coding For Beginners

Here you can read online TAM - JAVASCRIPT CODING EXERCISES: Coding For Beginners full text of the book (entire story) in english for free. Download pdf and epub, get meaning, cover and reviews about this ebook. year: 2020, genre: Computer. Description of the work, (preface) as well as reviews are available. Best literature library LitArk.com created for fans of good reading and offers a wide selection of genres:

Romance novel Science fiction Adventure Detective Science History Home and family Prose Art Politics Computer Non-fiction Religion Business Children Humor

Choose a favorite category and find really read worthwhile books. Enjoy immersion in the world of imagination, feel the emotions of the characters or learn something new for yourself, make an fascinating discovery.

No cover
  • Book:
    JAVASCRIPT CODING EXERCISES: Coding For Beginners
  • Author:
  • Genre:
  • Year:
    2020
  • Rating:
    4 / 5
  • Favourites:
    Add to favourites
  • Your mark:
    • 80
    • 1
    • 2
    • 3
    • 4
    • 5

JAVASCRIPT CODING EXERCISES: Coding For Beginners: summary, description and annotation

We offer to read an annotation, description, summary or preface (depends on what the author of the book "JAVASCRIPT CODING EXERCISES: Coding For Beginners" wrote himself). If you haven't found the necessary information about the book — write in the comments, we will try to find it.

JAVASCRIPT CODING EXERCISES: Coding For Beginners — read online for free the complete book (whole text) full work

Below is the text of the book, divided by pages. System saving the place of the last page read, allows you to conveniently read the book "JAVASCRIPT CODING EXERCISES: Coding For Beginners" online for free, without having to search again every time where you left off. Put a bookmark, and you can go to the page where you finished reading at any time.

Light

Font size:

Reset

Interval:

Bookmark:

Make
JAVASCRIPT
CODING EXERCISES
CODING FOR BEGINNERS
JJ TAM
Display the current day and time
HTML CODE
JAVASCRIPT CODE
var today = new Date();
var day = today.getDay();
var daylist = ["Sunday","Monday","Tuesday","Wednesday ","Thursday","Friday","Saturday"];
console.log("Today is : " + daylist[day] + ".");
var hour = today.getHours();
var minute = today.getMinutes();
var second = today.getSeconds();
var prepand = (hour >= 12)? " PM ":" AM ";
hour = (hour >= 12)? hour - 12: hour;
if (hour===0 && prepand===' PM ')
{
if (minute===0 && second===0)
{
hour=12;
prepand=' Noon';
}
else
{
hour=12;
prepand=' PM';
}
}
if (hour===0 && prepand===' AM ')
{
if (minute===0 && second===0)
{
hour=12;
prepand=' Midnight';
}
else
{
hour=12;
prepand=' AM';
}
}
console.log("Current Time : "+hour + prepand + " : " + minute + " : " + second);
Print the contents
of the current window
HTML CODE

Click the button to print the current page.

Print this page
JAVASCRIPT CODE
function print_current_page()
{
window.print();
}
Display the current date
HTML CODE
JAVASCRIPT CODE
var today = new Date();
var dd = today.getDate();
var mm = today.getMonth()+1;
var yyyy = today.getFullYear();
if(dd<10)
{
dd='0'+dd;
}
if(mm<10)
{
mm='0'+mm;
}
today = mm+'-'+dd+'-'+yyyy;
console.log(today);
today = mm+'/'+dd+'/'+yyyy;
console.log(today);
today = dd+'-'+mm+'-'+yyyy;
console.log(today);
today = dd+'/'+mm+'/'+yyyy;
console.log(today);
Find the area of a triangle
HTML CODE
JAVASCRIPT CODE
var side1 = 5;
var side2 = 6;
var side3 = 7;
var s = (side1 + side2 + side3)/2;
var area = Math.sqrt(s*((s-side1)*(s-side2)*(s-side3)));
console.log(area);
Check whether a given year is a leap year
HTML CODE
JAVASCRIT CODE
function leapyear(year)
{
return (year % 100 === 0) ? (year % 400 === 0) : (year % 4 === 0);
}
console.log(leapyear(2016));
console.log(leapyear(2000));
console.log(leapyear(1700));
console.log(leapyear(1800));
console.log(leapyear(100));
OUTPUT
true
true
false
false
false
Calculate multiplication and division
of two numbers
HTML CODE
body {margin: 30px;}
1st Number :
2nd Number:

The Result is :

JAVASCRIPT CODE
function multiplyBy()
{
num1 = document.getElementById("firstNumber").value;
num2 = document.getElementById("secondNumber").value;
document.getElementById("result").innerHTML = num1 * num2;
}
function divideBy()
{
num1 = document.getElementById("firstNumber").value;
num2 = document.getElementById("secondNumber").value;
document.getElementById("result").innerHTML = num1 / num2;
}
OUTPUT
Convert temperatures To and from celsius Fahrenheit in JAVASCRIPT HTML CODE - photo 1
Convert temperatures
To and from celsius, Fahrenheit in JAVASCRIPT
HTML CODE
JAVASCRIPT CODE
function cToF(celsius)
{
var cTemp = celsius;
var cToFahr = cTemp * 9 / 5 + 32;
var message = cTemp+'\xB0C is ' + cToFahr + ' \xB0F.';
console.log(message);
}
function fToC(fahrenheit)
{
var fTemp = fahrenheit;
var fToCel = (fTemp - 32) * 5 / 9;
var message = fTemp+'\xB0F is ' + fToCel + '\xB0C.';
console.log(message);
}
cToF(60);
fToC(45);
OUTPUT
60C is 140 F.
45F is 7.222222222222222C.
Find the largest
Of three given integers
HTML CODE
JAVASCRIPT CODE
function max_of_three(x, y, z)
{
max_val = 0;
if (x > y)
{
max_val = x;
} else
{
max_val = y;
}
if (z > max_val)
{
max_val = z;
}
return max_val;
}
console.log(max_of_three(1,0,1));
console.log(max_of_three(0,-10,-20));
console.log(max_of_three(1000,510,440));
Output:
1000
Reverse a given string
HTML CODE
JAVASCRIPT CODE
function string_reverse(str)
{
return str.split("").reverse().join("");
}
console.log(string_reverse("jsresource"));
console.log(string_reverse("www"));
console.log(string_reverse("JavaScript"));
OUTPUT
ecruosersj
www
tpircSavaJ
Replace every character
with the character following it in the alphabet
HTML CODE
JAVASCRIPT CODE
function string_reverse(str)
function LetterChanges(text) {
//https://goo.gl/R8gn7u
var s = text.split('');
for (var i = 0; i < s.length; i++) {
// Caesar cipher
switch(s[i]) {
case ' ':
break;
case 'z':
s[i] = 'a';
break;
case 'Z':
s[i] = 'A';
break;
default:
s[i] = String.fromCharCode(1 + s[i].charCodeAt(0));
}
// Upper-case vowels
switch(s[i]) {
case 'a': case 'e': case 'i': case 'o': case 'u':
s[i] = s[i].toUpperCase();
}
}
return s.join('');
}
console.log(LetterChanges("PYTHON"));
console.log(LetterChanges("W3R"));
console.log(LetterChanges("php"));
Output:
QZUIPO
X4S
qIq
Capitalize The First Letter
Of Each Word
Of A Given String
HTML CODE
JAVASCRIPT CODE
function capital_letter(str)
{
str = str.split(" ");
for (var i = 0, x = str.length; i < x; i++) {
str[i] = str[i][0].toUpperCase() + str[i].substr(1);
}
return str.join(" ");
}
console.log(capital_letter("Write a JavaScript program to capitalize the first letter of each word of a given string."));
OUTPUT
Output:
Write A JavaScript Program To Capitalize The First Letter Of Each Word Of A Given String.
Convert number to hours and minutes
HTML CODE
JAVASCRIPT CODE
function time_convert(num)
{
var hours = Math.floor(num / 60);
var minutes = num % 60;
return hours + ":" + minutes;
}
console.log(time_convert(71));
console.log(time_convert(450));
console.log(time_convert(1441));
OUTPUT
1:11
7:30
24:1
Count vowels in a given string
HTML CODE
JAVASCRIPT CODE
function vowel_Count(str)
{
return str.replace(/[^aeiou]/g, "").length;
Next page
Light

Font size:

Reset

Interval:

Bookmark:

Make

Similar books «JAVASCRIPT CODING EXERCISES: Coding For Beginners»

Look at similar books to JAVASCRIPT CODING EXERCISES: Coding For Beginners. We have selected literature similar in name and meaning in the hope of providing readers with more options to find new, interesting, not yet read works.


Reviews about «JAVASCRIPT CODING EXERCISES: Coding For Beginners»

Discussion, reviews of the book JAVASCRIPT CODING EXERCISES: Coding For Beginners and just readers' own opinions. Leave your comments, write what you think about the work, its meaning or the main characters. Specify what exactly you liked and what you didn't like, and why you think so.