Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion JavaScript_Basics/string_operation.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,17 @@ console.log(oldBio); // My college is SIESGST. Our seniors and alumnus are best

console.log(bio); // My college is SIESGST. Our seniors and alumnus are best in Mumbai My name is Swapnil Satish Shinde I belong to Computer Science branch

// Output by both the methods is same but string interpolation is more beautiful as we only have to right 1 line for all we want
// Output by both the methods is same but string interpolation is more beautiful as we only have to right 1 line for all we want

/** Capitalizing a string
*
* Here's a simple way to capitalize a string
*/
String.prototype.capitalize = (string) => string.slice(0, 1).toUpperCase() + string.slice(1)
console.log("a casual lower case string")
// Prints out: "A casual lower case string"


/** EXERCISE **/
// Add a function to the string prototype that counts the occurrences of a substring
// 'cheese and Bananas, and more cheese'.count('cheese') -----> 2