Coder Social home page Coder Social logo

exercise10's Introduction

exercise10

In the provided code, comments are used to explain and document the different parts of the program. Comments are used to provide information to other developers (and to yourself in the future) about the purpose and functionality of the code. Here's how comments are used in this code:

  1. The block comment at the beginning provides an overview of the program, including the author's name and the date. It also describes the purpose of the program, which is to change the name cases into lower, upper, and title case.

  2. Line comments are used throughout the code to describe each step or action being taken:

    • // Taking name in a variable: This comment indicates that a variable named personName is being used to store the input name.

    • // this will change name to lower case: This comment explains that the toLowerCase() function is used to convert the name to lowercase, and the result is stored in the lowercaseName variable.

    • // this will change it to upper case: This comment indicates that the toUpperCase() function is used to convert the name to uppercase, and the result is stored in the uppercaseName variable.

    • // this will split the name from spaces into an array of words: This comment describes that the split() function is used to break the name into an array of words using spaces as separators, and the result is stored in the words array.

    • The subsequent comments inside the for loop explain the steps involved in converting the name to title case using a loop.

  3. The final part of the code contains three console.log() statements. Although not explicitly commented, these are used to display the results of the program to the console.

By adding comments, the code becomes more understandable to others who might read it later or for the original author who might revisit the code after a long time. It helps in providing context and clarifying the purpose of different sections of the code.

exercise10's People

Contributors

6333kamran avatar typescriptkamran avatar

Stargazers

Faraz Baber avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.