You are on page 1of 2

Learning exercises ICT 10

JavaScript Strings

Activity 01:
Directions. Perform the programming code below.

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript Strings</h2>

<p id="demo"></p>

<script>
// x is a string
let x = "Trishia";

// y is an object
let y = new String("Trishia");

document.getElementById("demo").innerHTML =
typeof x + "<br>" + typeof y;
</script>

</body>
</html>

<!DOCTYPE html>
<html>
<body>

<h2>Never Create Strings as Objects</h2>


<p>Strings and objects cannot be safely compared.</p>

<p id="demo"></p>

<script>
let x = "John"; // x is a string
let y = new String("John"); // y is an object
document.getElementById("demo").innerHTML = (x==y);
</script>

</body>
</html>
<!DOCTYPE html>
<html>
<body>

<h2>Never Create Strings as Objects</h2>


<p>JavaScript objects cannot be compared.</p>

<p id="demo"></p>

<script>
let x = new String("John"); // x is an object
let y = new String("John"); // y is an object
document.getElementById("demo").innerHTML = (x==y);
</script>

</body>
</html>

Prepared by:

Robert S. Pugayan Jr.


TLE Subject Teacher

Noted:

_______________________

Activity 1: Rubrics
Points Description
10 The student successfully executes the program without guidance or supervision.
The student successfully executes the program with very little supervision and
9
guidance.
The student successfully executes the program with moderate supervision andguidance.
8
The student was not able to execute the program but shows eagerness to accomplishthe
7
activity.
5 The student was not able to execute the program due to lack of interest in the activity.

You might also like