/JavaScript-UI-Manipulation-Exercises

Explore JavaScript's power by practicing UI manipulation. These exercises cover sum calculation, value swapping, name separation, absolute value calculation, and arithmetic operations. Perfect for honing your JavaScript and interface design skills!

Primary LanguageHTML

Sure, here's an overview of each JavaScript function without the HTML interface part:

Exercise 1: Calculating Sum

  • JavaScript Function (calculerSomme()):
    • Retrieves the values entered in the input fields.
    • Converts the values to integers and calculates their sum.
    • Updates the content of an element with the calculated sum.

Exercise 2: Swapping Values

  • JavaScript Function (swapValues()):
    • Retrieves the values entered in two input fields.
    • Swaps the values between the two input fields.

Exercise 3: Separating Name

  • JavaScript Function (separateName()):
    • Retrieves the full name entered in an input field.
    • Separates the full name into last name and first name using indexOf() and slice() functions.
    • Updates the content of separate elements with the separated last name and first name.

Exercise 4: Calculating Absolute Value

  • JavaScript Function (calculerValeurAbsolue()):
    • Retrieves the value entered in an input field.
    • Calculates the absolute value using the Math.abs() function.
    • Updates the content of an element with the calculated absolute value.

Exercise 5: Performing Arithmetic Operations

  • JavaScript Function (calculer()):
    • Retrieves the values entered in two input fields and the selected operation.
    • Performs the selected arithmetic operation (+, -, *, /) on the two numbers.
    • Updates the content of an element with the calculated result.

These JavaScript functions are designed to perform specific tasks as part of the exercises, such as calculation, value manipulation, and result display, without directly interacting with the HTML interface.