Friday, 6 March 2015

Week 38: March 2 - 6 JavaScript 6!

Hi!

Yeah! We had been started typing in JavaScript 6. We've rushed typing the JavaScript 6 for the reward of having a plus 10 points in our quiz. So everyone of us wanted to get it but nobody got it because it was too long to type of.:( ]

Here are the examples:

 In JavaScript, almost "everything" is an object.
  • Booleans can be objects (or primitive data treated as objects)
  • Numbers can be objects (or primitive data treated as objects)
  • Strings can be objects (or primitive data treated as objects)
  • Dates are always objects
  • Maths are always objects
  • Regular expressions are always objects
  • Arrays are always objects
  • Functions are always objects
  • Objects are objects
In JavaScript, all values, except primitive values, are objects.
Primitive values are: strings ("John Doe"), numbers (3.14), true, false, null, and undefined.  

The Object() Constructor:

A constructor is a function that creates and initializes an object. JavaScript provides a special constructor function called Object() to build the object. The return value of the Object() constructor is assigned to a variable.
The variable contains a reference to the new object. The properties assigned to the object are not variables and are not defined with the var keyword.

Example 1:

This example demonstrates how to create an object:
<html>
<head>
<title>User-defined objects</title>
<script type="text/javascript">
var book = new Object();   // Create the object
    book.subject = "Perl"; // Assign properties to the object
    book.author  = "Mohtashim";
</script>
</head>
<body>
<script type="text/javascript">
   document.write("Book name is : " + book.subject + "<br>");
   document.write("Book author is : " + book.author + "<br>");
</script>
</body>
</html>


Taken from http://www.tutorialspoint.com/javascript/javascript_objects.htm.

signing off...

Friday, 27 February 2015

Week 37: February 23-27 Yeah you!

Hi!

   Haist...It's foundation day in our school! So we don't have a regular  classes this week because of such contests had begun within two days. Yeah! While on Wednesday, we celebrated also the People Power. On the next day, we don't had another class in TLE because it's our vacant. On Friday, we took a dry run for the preparation of taking the NAT exam. So sad..:( Almost we did'nt met on that week.














Pictures taken from https://www.google.com.ph/search?q=dry+run&espv=2&biw=1024&bih=634&source=lnms&tbm=isch&sa=X&ei=YYT5VPK-LoPEmAXKtYGYBQ&ved=0CAYQ_AUoAQ#tbm=isch&q=exam+&imgdii=_&imgrc=cR3V4P88rUX3hM%253A%3BTu8PPXguvs2GMM%3Bhttp%253A%252F%252F3.bp.blogspot.com%252F-Udtpy_hEfsg%252FTzvceSPuv6I%252FAAAAAAAAAwk%252FISzqrKsuelc%252Fs1600%252Fchildren%252Bexam.gif%3Bhttp%253A%252F%252Fganeshkamath89.blogspot.com%252F2012%252F02%252Fdo-exams-matter.html%3B1221%3B1314

signing off...

Friday, 20 February 2015

Week 36: February 16-20 It seems easy!

 Hi!

 We did another exercise! I did't enter to our class in ICT because I took the exam in Mapeh. We create a function called changeColor() that will be called when the user presses one of two buttons. The first button will contain the text "Press here for a yellow background". The second button will contain the text "Press here for a light green background". The function will take one parameter, a color. Its function is to change the background color of the current document.



A JavaScript function is a block of code designed to perform a particular task.
A JavaScript function is executed when "something" invokes it (calls it).
A JavaScript can be executed when an event occurs, like when a user clicks on an HTML element.
To execute code when a user clicks on an element, add JavaScript code to an HTML event attribute:
Examples of HTML events:
  • When a user clicks the mouse
  • When a web page has loaded
  • When an image has been loaded
  • When the mouse moves over an element
  • When an input field is changed
  • When an HTML form is submitted
  • When a user strokes a key
 The onClick event executes a JavaScript when a button is clicked.  


Taken from http://www.w3schools.com/js/js_htmldom_events.asp.

Friday, 13 February 2015

Week 35: February 9-13 Learn more!


     Hi!

   We did another exercise...

 We copied the following file and we executed it in our browser. And we will find what's wrong with it and why? Then we will fix it. Haist...I did'nt get it again, as always Jessa got the correct answer. 




    The World Wide Web got its spidery name from the plentiful connections (links) that link websites together with the click of a button. What most people don't know is that HTML links are actually HTML anchors constructed using anchor tags (<a>).

     A Hypertext Reference (href) is an HTML attribute of an anchor (link) tag that requires a valid URL in order to properly direct a user to a different location. In other words, this Hypertext Reference is where users will navigate to if they do click on this link.         
Taken from http://www.tizag.com/htmlT/links.php, http://www.w3schools.com/html/html_links.asp



 When a function has performed an assignment, it may provide a value that other functions would need, for any reason you judge necessary. When a function produces a value and makes it available to other functions, such a function is said to return a value.

   To define a function that returns a value, just before the closing curly bracket, type the return keyword followed by the value that the function returns. The value should be a valid and expected type. Because JavaScript is not a type-checking language, meaning it hardly checks anything you are doing, it is your responsibility to make sure that your function returns the right value.
Taken from http://www.functionx.com/javascript/Lesson05.htm


signing off...

Friday, 6 February 2015

Week 34: February 2-6: Pleasant!


 Hi!


       We have our new lesson! 

        What is function?


     A function is a group of reusable code which can be called anywhere in your programme. This eliminates the need of writing same code again and again. This will help programmers to write modular code. You can divide your big programme in a number of small and manageable functions.
























Like any other advance programming language, JavaScript also supports all the features necessary to write modular code using functions.

You must have seen functions like alert() and write() in previous chapters. We are using these function again and again but they have been written in core JavaScript only once.
JavaScript allows us to write our own functions as well. This section will explain you how to write your own functions in JavaScript.

Function Definition:

   Before we use a function we need to define that function. The most common way to define a function in JavaScript is by using the function keyword, followed by a unique function name, a list of parameters (that might be empty), and a statement block surrounded by curly braces. The basic syntax is shown here:
<script type="text/javascript">
<!--
function functionname(parameter-list)
{
  statements
}
//-->
</script>

Example:

A simple function that takes no parameters called sayHello is defined here:
<script type="text/javascript">
<!--
function sayHello()
{
   alert("Hello there");
}
//-->
</script>

Calling a Function:

To invoke a function somewhere later in the script, you would simple need to write the name of that function as follows:
<script type="text/javascript">
<!--
sayHello();
//-->
</script>
To understand it in better way you can Try it yourself.

Function Parameters:

Till now we have seen function without a parameters. But there is a facility to pass different parameters while calling a function. These passed parameters can be captured inside the function and any manipulation can be done over those parameters.
A function can take multiple parameters separated by comma.

Example:

Let us do a bit modification in our sayHello function. This time it will take two parameters:
<script type="text/javascript">
<!--
function sayHello(name, age)
{
   alert( name + " is " + age + " years old.");
}
//-->
</script>
Note: We are using + operator to concatenate string and number all together. JavaScript does not mind in adding numbers into strings.
Now we can call this function as follows:
<script type="text/javascript">
<!--
sayHello('Zara', 7 );
//-->
</script>

The return Statement:

    A JavaScript function can have an optional return statement. This is required if you want to return a value from a function. This statement should be the last statement in a function.
For example you can pass two numbers in a function and then you can expect from the function to return their multiplication in your calling program.

Example:

This function takes two parameters and concatenates them and return resultant in the calling program:
<script type="text/javascript">
<!--
function concatenate(first, last)
{
   var full;

   full = first + last;
   return  full;
}
//-->
</script>
Now we can call this function as follows:
<script type="text/javascript">
<!--
   var result;
   result = concatenate('Zara', 'Ali');
   alert(result );
//-->
</script>


Taken from http://www.tutorialspoint.com/javascript/javascript_functions.htm
signing off..






Friday, 30 January 2015

Week 33: January 26-30 No idea!

Hi!

        I'm done with exercise 4!



    The while statement evaluates expression, which must return a boolean value. If the expression evaluates to true, the whilestatement executes the statement(s) in the while block. The while statement continues testing the expression and executing its block until the expression evaluates to false.





Using  a do while loop and a switch statement to evaluate the menu item selected to produce output similar to what you see below.


      Do while loop executes group of Java statements as long as the boolean condition evaluates to true.It is possible that the statement block associated with While loop never get executed because While loop tests the boolean condition before executing the block of statements associated with it.

     In Java programming, sometime it's necessary to execute the block of statements at least once before evaluating the boolean condition. Do while loop is similar to the While loop, but it evaluates the booleancondition after executing the block of the statement.



  Credits: http://www.java-examples.com/do-while-loop
   And we did prejs4quiz and js4quiz! I have no idea! So I did'nt made it as usual as always.:(




Friday, 23 January 2015

Week 32: Jan.19-23 Exercises!

Hi!


      We don't  have class in our ICT Class on Monday and Tuesday.  On wednesday, I've  finished my exercise 2 and 3. While on friday, I had finished my exercise 4.  But I did'nt know how to make the exercise 5. I tried my best.

 
      Here are examples.







    Number() converts to a Number, String() converts to a String, Boolean() converts to a Boolean.

JavaScript Data Types

In JavaScript there are 5 different data types that can contain values:
  • string
  • number
  • boolean
  • object
  • function
There are 3 types of objects:
  • Object
  • Date
  • Array
And 2 data types that cannot contain values:
  • null
  • undefined

The typeof Operator

You can use the typeof operator to find the data type of a JavaScript variable.

Example

typeof "John"                 // Returns string typeof 3.14                   // Returns numbertypeof NaN                    // Returns numbertypeof false                  // Returns booleantypeof [1,2,3,4]              // Returns objecttypeof {name:'John', age:34}  // Returns objecttypeof new Date()             // Returns objecttypeof function () {}         // Returns functiontypeof myCar                  // Returns undefined (if myCar is not declared)typeof null                   // Returns object
Please observe:
  • The data type of NaN is number
  • The data type of an array is object
  • The data type of a date is object
  • The data type of null is object
  • The data type of an undefined variable is undefined
You cannot use typeof to define if an object is an JavaScript Array or a JavaScript Date.

Taken from http://www.w3schools.com/js/js_type_conversion.asp.
signing off...

Hi!

Yeah! We had been started typing in JavaScript 6. We've rushed typing the JavaScript 6 for the reward of having a plus 10 points in our quiz. So everyone of us wanted to get it but nobody got it because it was too long to type of.:( ]

Here are the examples:

 In JavaScript, almost "everything" is an object.
  • Booleans can be objects (or primitive data treated as objects)
  • Numbers can be objects (or primitive data treated as objects)
  • Strings can be objects (or primitive data treated as objects)
  • Dates are always objects
  • Maths are always objects
  • Regular expressions are always objects
  • Arrays are always objects
  • Functions are always objects
  • Objects are objects
In JavaScript, all values, except primitive values, are objects.
Primitive values are: strings ("John Doe"), numbers (3.14), true, false, null, and undefined.  

The Object() Constructor:

A constructor is a function that creates and initializes an object. JavaScript provides a special constructor function called Object() to build the object. The return value of the Object() constructor is assigned to a variable.
The variable contains a reference to the new object. The properties assigned to the object are not variables and are not defined with the var keyword.

Example 1:

This example demonstrates how to create an object:
<html>
<head>
<title>User-defined objects</title>
<script type="text/javascript">
var book = new Object();   // Create the object
    book.subject = "Perl"; // Assign properties to the object
    book.author  = "Mohtashim";
</script>
</head>
<body>
<script type="text/javascript">
   document.write("Book name is : " + book.subject + "<br>");
   document.write("Book author is : " + book.author + "<br>");
</script>
</body>
</html>


Taken from http://www.tutorialspoint.com/javascript/javascript_objects.htm.

signing off...

Week 38: March 2 - 6 JavaScript 6!

Friday, 6 March 2015
Posted by Unknown
Hi!

   Haist...It's foundation day in our school! So we don't have a regular  classes this week because of such contests had begun within two days. Yeah! While on Wednesday, we celebrated also the People Power. On the next day, we don't had another class in TLE because it's our vacant. On Friday, we took a dry run for the preparation of taking the NAT exam. So sad..:( Almost we did'nt met on that week.














Pictures taken from https://www.google.com.ph/search?q=dry+run&espv=2&biw=1024&bih=634&source=lnms&tbm=isch&sa=X&ei=YYT5VPK-LoPEmAXKtYGYBQ&ved=0CAYQ_AUoAQ#tbm=isch&q=exam+&imgdii=_&imgrc=cR3V4P88rUX3hM%253A%3BTu8PPXguvs2GMM%3Bhttp%253A%252F%252F3.bp.blogspot.com%252F-Udtpy_hEfsg%252FTzvceSPuv6I%252FAAAAAAAAAwk%252FISzqrKsuelc%252Fs1600%252Fchildren%252Bexam.gif%3Bhttp%253A%252F%252Fganeshkamath89.blogspot.com%252F2012%252F02%252Fdo-exams-matter.html%3B1221%3B1314

signing off...

Week 37: February 23-27 Yeah you!

Friday, 27 February 2015
Posted by Unknown
 Hi!

 We did another exercise! I did't enter to our class in ICT because I took the exam in Mapeh. We create a function called changeColor() that will be called when the user presses one of two buttons. The first button will contain the text "Press here for a yellow background". The second button will contain the text "Press here for a light green background". The function will take one parameter, a color. Its function is to change the background color of the current document.



A JavaScript function is a block of code designed to perform a particular task.
A JavaScript function is executed when "something" invokes it (calls it).
A JavaScript can be executed when an event occurs, like when a user clicks on an HTML element.
To execute code when a user clicks on an element, add JavaScript code to an HTML event attribute:
Examples of HTML events:
  • When a user clicks the mouse
  • When a web page has loaded
  • When an image has been loaded
  • When the mouse moves over an element
  • When an input field is changed
  • When an HTML form is submitted
  • When a user strokes a key
 The onClick event executes a JavaScript when a button is clicked.  


Taken from http://www.w3schools.com/js/js_htmldom_events.asp.

Week 36: February 16-20 It seems easy!

Friday, 20 February 2015
Posted by Unknown

     Hi!

   We did another exercise...

 We copied the following file and we executed it in our browser. And we will find what's wrong with it and why? Then we will fix it. Haist...I did'nt get it again, as always Jessa got the correct answer. 




    The World Wide Web got its spidery name from the plentiful connections (links) that link websites together with the click of a button. What most people don't know is that HTML links are actually HTML anchors constructed using anchor tags (<a>).

     A Hypertext Reference (href) is an HTML attribute of an anchor (link) tag that requires a valid URL in order to properly direct a user to a different location. In other words, this Hypertext Reference is where users will navigate to if they do click on this link.         
Taken from http://www.tizag.com/htmlT/links.php, http://www.w3schools.com/html/html_links.asp



 When a function has performed an assignment, it may provide a value that other functions would need, for any reason you judge necessary. When a function produces a value and makes it available to other functions, such a function is said to return a value.

   To define a function that returns a value, just before the closing curly bracket, type the return keyword followed by the value that the function returns. The value should be a valid and expected type. Because JavaScript is not a type-checking language, meaning it hardly checks anything you are doing, it is your responsibility to make sure that your function returns the right value.
Taken from http://www.functionx.com/javascript/Lesson05.htm


signing off...

Week 35: February 9-13 Learn more!

Friday, 13 February 2015
Posted by Unknown

 Hi!


       We have our new lesson! 

        What is function?


     A function is a group of reusable code which can be called anywhere in your programme. This eliminates the need of writing same code again and again. This will help programmers to write modular code. You can divide your big programme in a number of small and manageable functions.
























Like any other advance programming language, JavaScript also supports all the features necessary to write modular code using functions.

You must have seen functions like alert() and write() in previous chapters. We are using these function again and again but they have been written in core JavaScript only once.
JavaScript allows us to write our own functions as well. This section will explain you how to write your own functions in JavaScript.

Function Definition:

   Before we use a function we need to define that function. The most common way to define a function in JavaScript is by using the function keyword, followed by a unique function name, a list of parameters (that might be empty), and a statement block surrounded by curly braces. The basic syntax is shown here:
<script type="text/javascript">
<!--
function functionname(parameter-list)
{
  statements
}
//-->
</script>

Example:

A simple function that takes no parameters called sayHello is defined here:
<script type="text/javascript">
<!--
function sayHello()
{
   alert("Hello there");
}
//-->
</script>

Calling a Function:

To invoke a function somewhere later in the script, you would simple need to write the name of that function as follows:
<script type="text/javascript">
<!--
sayHello();
//-->
</script>
To understand it in better way you can Try it yourself.

Function Parameters:

Till now we have seen function without a parameters. But there is a facility to pass different parameters while calling a function. These passed parameters can be captured inside the function and any manipulation can be done over those parameters.
A function can take multiple parameters separated by comma.

Example:

Let us do a bit modification in our sayHello function. This time it will take two parameters:
<script type="text/javascript">
<!--
function sayHello(name, age)
{
   alert( name + " is " + age + " years old.");
}
//-->
</script>
Note: We are using + operator to concatenate string and number all together. JavaScript does not mind in adding numbers into strings.
Now we can call this function as follows:
<script type="text/javascript">
<!--
sayHello('Zara', 7 );
//-->
</script>

The return Statement:

    A JavaScript function can have an optional return statement. This is required if you want to return a value from a function. This statement should be the last statement in a function.
For example you can pass two numbers in a function and then you can expect from the function to return their multiplication in your calling program.

Example:

This function takes two parameters and concatenates them and return resultant in the calling program:
<script type="text/javascript">
<!--
function concatenate(first, last)
{
   var full;

   full = first + last;
   return  full;
}
//-->
</script>
Now we can call this function as follows:
<script type="text/javascript">
<!--
   var result;
   result = concatenate('Zara', 'Ali');
   alert(result );
//-->
</script>


Taken from http://www.tutorialspoint.com/javascript/javascript_functions.htm
signing off..






Week 34: February 2-6: Pleasant!

Friday, 6 February 2015
Posted by Unknown
Hi!

        I'm done with exercise 4!



    The while statement evaluates expression, which must return a boolean value. If the expression evaluates to true, the whilestatement executes the statement(s) in the while block. The while statement continues testing the expression and executing its block until the expression evaluates to false.





Using  a do while loop and a switch statement to evaluate the menu item selected to produce output similar to what you see below.


      Do while loop executes group of Java statements as long as the boolean condition evaluates to true.It is possible that the statement block associated with While loop never get executed because While loop tests the boolean condition before executing the block of statements associated with it.

     In Java programming, sometime it's necessary to execute the block of statements at least once before evaluating the boolean condition. Do while loop is similar to the While loop, but it evaluates the booleancondition after executing the block of the statement.



  Credits: http://www.java-examples.com/do-while-loop
   And we did prejs4quiz and js4quiz! I have no idea! So I did'nt made it as usual as always.:(




Week 33: January 26-30 No idea!

Friday, 30 January 2015
Posted by Unknown
Hi!


      We don't  have class in our ICT Class on Monday and Tuesday.  On wednesday, I've  finished my exercise 2 and 3. While on friday, I had finished my exercise 4.  But I did'nt know how to make the exercise 5. I tried my best.

 
      Here are examples.







    Number() converts to a Number, String() converts to a String, Boolean() converts to a Boolean.

JavaScript Data Types

In JavaScript there are 5 different data types that can contain values:
  • string
  • number
  • boolean
  • object
  • function
There are 3 types of objects:
  • Object
  • Date
  • Array
And 2 data types that cannot contain values:
  • null
  • undefined

The typeof Operator

You can use the typeof operator to find the data type of a JavaScript variable.

Example

typeof "John"                 // Returns string typeof 3.14                   // Returns numbertypeof NaN                    // Returns numbertypeof false                  // Returns booleantypeof [1,2,3,4]              // Returns objecttypeof {name:'John', age:34}  // Returns objecttypeof new Date()             // Returns objecttypeof function () {}         // Returns functiontypeof myCar                  // Returns undefined (if myCar is not declared)typeof null                   // Returns object
Please observe:
  • The data type of NaN is number
  • The data type of an array is object
  • The data type of a date is object
  • The data type of null is object
  • The data type of an undefined variable is undefined
You cannot use typeof to define if an object is an JavaScript Array or a JavaScript Date.

Taken from http://www.w3schools.com/js/js_type_conversion.asp.
signing off...

Week 32: Jan.19-23 Exercises!

Friday, 23 January 2015
Posted by Unknown
 

Blog Template by YummyLolly.com - Header made with PS brushes by gvalkyrie.deviantart.com
Sponsored by Free Web Space