Hodgkin–Huxley neurons can be used as logic gates to perform reliable logic operations under an optimal noise intensity window. Fluctuations in ion concentrations inside and outside the neuron cell generate time-varying electromagnetic fields regulating neuronal dynamics. In this paper, a modified Hodgkin–Huxley neuron model is used to report the phenomenon of logical stochastic resonance under electromagnetic effects. The results show that electromagnetic induction affects the speed of neuronal response when switching to logic signals. Appropriately reducing the magnitude of the external bias current allows Hodgkin–Huxley neurons to perform reliable logic operations while consuming less energy. However, regulating the signal strength requires a trade-off between the reliability of logic operations and energy consumption. We further extend the logical stochastic resonance effect to neuronal networks. It is found that an appropriate increase in coupling strength has a favorable impact on system logic operations. The dynamical mechanism is explained in terms of bifurcation diagrams and phase space. Finally, we also compare the difference in the reliability of logical operations between small-world and scale-free networks. Small-world networks outperform scale-free networks for logical operations. Our results contribute to the study of neuronal simulation circuits with logic computation functions, and provides important clues for building new neuron-based logic devices with high energy efficiency.