Laboratory experimentation has a vital role in science education. With the potential offered by information and communication technologies for the educational domain, virtual laboratories have emerged as a valuable alternative to face-to-face, hands-on laboratories. Moreover, the possibility of virtual laboratories opens new perspectives for higher education sustainability. They are a perfect approach for training learners to understand scientific principles in many fields of science by offering them the possibility to illustrate the scientific phenomena through automated and virtual practical activities that employ computer simulation. In this work, we present the use of computer simulation combined with the JavaScript programming language for the development of a low-cost virtual laboratory integrated into an interactive learning environment based on the Moodle platform. The methodology was based on the instructional design model ADDIE (Analysis, Design, Development, Implementation, and Evaluation), which structures the development planning of online teaching resources in different stages (analysis, design, development, implementation, and evaluation). The virtual laboratory was developed by Moroccan universities, with the help of European partners, and it was implemented in the 12 science faculties in Morocco. It presents a great choice for supporting laboratory activities for learners in the first year of their bachelor’s degree program. This virtual laboratory includes 12 virtual practical activities mapped to the physics curriculum, and they can be operated via the Internet on computers. The proposed virtual learning environment was evaluated by teachers and learners from the science faculties. The obtained results, together with similar findings from other studies, indicate the positive impact of the use of a virtual laboratory on learning outcomes, and support the adoption of the proposed learning environment in laboratory educational procedures as an alternative to physical laboratories.