What is a script? In Javascript

Start learning Javascript, but I try to understand a script is what?

Someone told me is a file, others told me is a program, other one is a section of the source code, I’m getting kinda confused.

I like this definition:

From Merriam-Webster: “a sequence of instructions or commands for a computer to execute, especially one that automates a small task (such as assembling or sorting a set of data).”


A script can be self-contained (entire program), or it can be part of a larger framework (a script in a website). The definition as a file not one I like, it can be a stand-alone file, but that’s not very indicative of what it does.

As you see more examples it’ll make more sense, don’t be alarmed if it doesn’t at first. It’s ok and normal for things not to make sense at first.

1 Like

Thanks

It’s a method or variable? A class? Object? Field?

All people give me general answers, could you be more specific if is possible, please?

Or I need to wait until I get an epiphany while I’m in a lesson of Java Script?

You will get the epiphany probably later haha. If it makes you feel any better, it’s not essential to know the definition (and it will come to you if you keep learning javascript).

method or variable? A class? Object? Field?

No, it’s one level up on the hierarchy. As for the generality of the answer, it’s not something that holds a strict definition because of multiple uses. So I want to stay within in the lines of what’s generally understood when people talk to each other about scripts.

Look here for a more varied discussion:

1 Like