Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.


    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

JavaScript FUCTION

JavaScript:
function monitorCount(rows, columns) {
  return rows * columns;
}

function costOfMonitors() {
  return monitorCount(rows, columns) * 2000

}

monitorCount(5, 7)

console.log(costOfMonitors());


THOUGH I HAVE PASSED ARGUMENT FOR ROWS AND COLUMNS , WHY AM I NOT GETTING VALUE IN CONSOLE?
 
Last edited by a moderator:
JavaScript:
function monitorCount(rows, columns) {
  return rows * columns;
}

 function costOfMonitors() {
  return monitorCount(rows, columns) * 2000
}

monitorCount(5, 7)

console.log(costOfMonitors());


Though i have passed arguments for rows and columns , why am i not getting data in console??
 
You are passing the arguments in wrong place and calling function somewhere else and what ends up happening is when you are passing the values it works but you are not previewing that and when are previewing it you are not passing the value. I think you are very confused how a function works in JavaScript. Regardless here is the code to make that work:

JavaScript:
 function monitorCount(rows, columns) {
        return rows * columns;
      }

      function costOfMonitors(rows, columns) {
        return monitorCount(rows, columns) * 2000;
      }

      console.log(monitorCount(5, 7)); // first fucntion works.

      console.log(costOfMonitors(5, 7)); // to call the first function with second function.

I would recommend reading this blog to get better understanding of the functions in JavaScript.
 
Last edited by a moderator:

New Threads

Latest posts

Buy us a coffee!

Back
Top Bottom