Load Node Drupal 8

How to load a node in Drupal 8

To load a node in Drupal 8 use this code.

$node = \Drupal\node\Entity\Node::load($nid);

Example:-

$node = \Drupal\node\Entity\Node::load(100);

How to load multiple nodes in Drupal 8

To load multiple nodes in Drupal 8 use this code.

$nodes = \Drupal\node\Entity\Node::loadMultiple($nids);

Example:-

$nodes = \Drupal\node\Entity\Node:: loadMultiple(array(100, 200, 300));