• + 1 comment

    If you plan to complete this in node here is a small tutorial: Typecasting We use parseInt() function to parse to integer and parsefloat to parse the double number. Number() is also another function you can use

      let str = "123.45";
        let int1 = parseInt(str); // int1 will be 123
        let str2 = "abc123";
        let int2 = parseInt(str2); // int2 will be NaN (Not a Number)
        let hexStr = "0xF";
    

    Precision In JavaScript, the Number.prototype.toFixed() method is commonly used to control the precision of a number after the decimal point. This method formats a number using fixed-point notation and returns a string representation of the number with a specified number of digits after the decimal point.

    const preciseNum = num.toFixed(2); // "123.46" (rounds to 2 decimal places)
    const paddedNum = num.toFixed(5);  // "123.45679" (rounds to 5 decimal places)
    const zeroDecimals = num.toFixed(0); // "123" (rounds to nearest int``
    **Solution**
    // Declare second integer, double, and String variables.
        var v2,doub,str;
        // Read and save an integer, double, and String to your variables.
            v2= parseInt(readLine());
            doub = parseFloat(readLine());
            str = readLine();
        // Print the sum of both integer variables on a new line.
    console.log(i+v2);
        // Print the sum of the double variables on a new line.
    console.log((d+doub).toFixed(1));
        // Concatenate and print the String variables on a new line
        // The 's' variable above should be printed first.
        console.log(s+str);eger)