Variables and functions

Hi, i’m a total beginner.
To help me understand, can i say that:

Variables are defined by an equal (=) and functions call the variables contained in brackets ()?

What is the difference between and ()?

Thanks for help and sorry for revamping such an old topic :sweat_smile:

This is partly correct. Variables are defined by and = sign. Functions don’t call the variables in (), as such, they act on them. The variables in () are arguments. They work just like normal variables, except that when you call (run) a function, you don’t have to use the same variable names.

function adding(x, y) {
var sum = x + y;
return sum
const sumOf = adding(4, 3) //Notice how I don't call the same variables, yet it still works?
//This returns 7.

The surround a list, which can contain multiple elements: [“this”, “is”, “a”, “list”]. () Are used for functions, both built in and writer made. For example:

const exampleString = "Hello World!"
var lastIndexOf = str.lastIndexLocate("o") //would return 6.
function x(param){
x(param)//calls the function 'x')

I hope this has helped!