📘 Premium Read: Access my best content on Medium member-only articles — deep dives into Java, Spring Boot, Microservices, backend architecture, interview preparation, career advice, and industry-standard best practices.
✅ Some premium posts are free to read — no account needed. Follow me on Medium to stay updated and support my writing.
🎓 Top 10 Udemy Courses (Huge Discount): Explore My Udemy Courses — Learn through real-time, project-based development.
▶️ Subscribe to My YouTube Channel (172K+ subscribers): Java Guides on YouTube
let strArray = ["A", "B", "C","D", "E"];
strArray.length = 0;
var intArray = [1,2,3,4,5,6,7]
intArray = [];
Complete Example
var strArray = ["A", "B", "C","D", "E"];
var intArray = [1,2,3,4,5,6,7]
function emptyArray(){
console.log(" Before empty an array : " + strArray);
strArray.length = 0;
console.log(" After empty an array : " + strArray);
console.log(" Before empty an array : " + intArray);
intArray = [];
console.log(" After empty an array : " + intArray);
}
emptyArray();
Before empty an array : A,B,C,D,E
After empty an array :
Before empty an array : 1,2,3,4,5,6,7
After empty an array :
Comments
Post a Comment
Leave Comment