DEV Community

Discussion on: How to improve my programing logic?

Collapse
 
budisalah profile image
Budi Salah 🐋 • Edited

Thank you all guys for your answers. @jhordan92 @rinisimon @georgehanson
Forgive me if I sound like a stupid right now but can anyone give me an example.
Let's take this example from Eloquent Javascript:

Quiz: Write a program that creates a string that represents an 8×8 grid, using newline characters to separate lines. At each position of the grid there is either a space or a "#" character. The characters should form a chessboard. Passing this string to console.log should show something like this:

# # # #
 # # # #
# # # #
 # # # #
# # # #
 # # # #
# # # #
 # # # #

When you have a program that generates this pattern, define a binding size = 8 and change the program so that it works for any size, outputting a grid of the given width and height.

I want to know how you gonna planning for this code, How I'm gonna know how many variable I'm gonna use, What's is step #1 and so on.
Thanks.