Strings in JavaScript (OCR A-Level Computer Science): Revision Notes
📚 Revision Notes
Strings in JavaScript
Overview
Strings are sequences of characters used for text. JavaScript provides several methods for handling and manipulating strings.
Key Concepts
- Basic Properties: Strings have properties like .length.
- Common Methods: .substring(), .toUpperCase(), .toLowerCase().
lightbulbExample
Example:
let name = "JavaScript";
console.log(name.length); // Outputs 10
console.log(name.toUpperCase()); // Outputs "JAVASCRIPT"
Common Mistakes
- Using == instead of === for comparison: Always use === for strict equality.
infoNote
Key Takeaways
- Understand common string methods and when to use them.