The Arduino Uno and Nano can measure their own VCC.
The VCC is used as reference voltage to measure its internal voltage reference. By reversing the calculation, the VCC can be calculated if the internal voltage reference is known.
If you connect the battery to the 5V pin, then you don't need to add any resistors of any wire. The Arduino can measure that voltage.
Search for "arduino secret voltmeter" or something like that.
Not all Youtube videos are good. You might learn wrong things.
We don't measure a voltage with the 5V as reference when it is not a stable voltage. We don't fix a (temporary) lower 5V in the sketch. We calculate the voltage in a different way. We don't use String when it is not needed.
You should also be careful with Instructables.com, there are also some questionable tutorials over there.