Is work really a scalar?

1. The problem statement, all variables and given/known data
Fact: Being the dot product of force and distance, work is a scalar. Fragment from my textbook: The work done on the spring is ##\frac{1}{2}kx^2##, and so the work done by the spring is ##-\frac{1}{2}kx^2##.

2. Relevant equations
##W = f \cdot d ##

3. The attempt at a solution
I thought scalars don't have directions. Why is the "work done on" positive, while the "work done by" is negative?

1. The problem statement, all variables and given/known data
Fact: Being the dot product of force and distance, work is a scalar. Fragment from my textbook: The work done on the spring is ##\frac{1}{2}kx^2##, and so the work done by the spring is ##-\frac{1}{2}kx^2##.

2. Relevant equations
##W = f \cdot d ##

3. The attempt at a solution
I thought scalars don't have directions. Why is the "work done on" positive, while the "work done by" is negative?

1. The problem statement, all variables and given/known data
Fact: Being the dot product of force and distance, work is a scalar. Fragment from my textbook: The work done on the spring is ##\frac{1}{2}kx^2##, and so the work done by the spring is ##-\frac{1}{2}kx^2##.

2. Relevant equations
##W = f \cdot d ##

3. The attempt at a solution
I thought scalars don't have directions. Why is the "work done on" positive, while the "work done by" is negative?

When you stretch a spring, you're doing work on the spring. According to Newton's third law, the spring exerts a force on you and therefore does work on you. The action and reaction forces point in opposite directions, but the displacement is the same in either case, so the work done on the spring by you and the work done by the spring on you are always negatives of each other.

Another way to look at it is that work is the transfer of energy. Energy goes from one thing to another, so in that sense there's a direction to work. It's like if I handed you a $1 bill. Money went from me to you, but you wouldn't say a $1 bill has a direction.