Preheat your oven to 350°F (175°C) and grease a 9x13-inch baking pan or line it with parchment paper for easy removal.
In a large mixing bowl, cream together the softened butter, brown sugar, and granulated sugar until it’s light and fluffy.
Beat in the eggs one at a time, followed by the vanilla extract, ensuring everything is well combined.
In a separate bowl, whisk together the flour, baking soda, and salt. Gradually add the dry ingredients to the wet mixture, mixing until just combined.
Fold in the chocolate chips and walnuts (if using), ensuring they are evenly distributed throughout the dough.
Spread the cookie dough evenly into the prepared baking pan, smoothing the top with a spatula.
Bake in the preheated oven for 25-30 minutes, or until the edges turn golden brown and a toothpick inserted in the center comes out with a few moist crumbs (but not wet batter).
Allow the cookie bars to cool in the pan for about 10 minutes before transferring them to a wire rack to cool completely.
Once cooled, cut them into squares or rectangles for serving.
Notes
Serve the cookie bars on a decorative platter. Dust with powdered sugar for an elegant finish, and accompany with a scoop of vanilla ice cream for an extra treat!